add 'mv' errmsg filter and apply in generic/682
cover add 'mv' errmsg filter and apply in generic/682
Hi, all:
I have noticed that after coreutils 9.4+, generic/682 will meet the same mismatch output just like generic/245 (commit d9323ad :'generic/245: Filter mv error message'). To fix this, we can seperate the filter ,move it into common
directory as '_filter_mv_err_msg' and apply it to similar cases.
Attention: in generic/419 and generic/369, there also exists "cannot move ... to ..." output. After testing, generic/419 don't need to apply filter. But I don't know how to enable 'richacl' on my filesystem, so I can't verify if generic/369 needs to be fixed.
Ferry Meng (1):
generic/682: apply 'mv' error message fitler.
common/filter | 13 +++++++++++++ tests/generic/245 | 9 ++++----- tests/generic/682 | 2 +- tests/generic/682.out | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-)
Signature · 1 line
2.19.1.6.gb485710b
PATCH 1/1 generic/682: apply 'mv' error message fitler.
As coreutils update to 9.4+, the 'mv' command change also results in the mismatch output of generic/682.
This case is similar to generic/245, you can refer to 'generic/245:
Filter mv error message'(commit d9323ad7a0). Now seperate this filter as '_filter_mv_err_msg', move it into common/filter, and apply in generic/682.
--- common/filter | 13 +++++++++++++ tests/generic/245 | 9 ++++----- tests/generic/682 | 2 +- tests/generic/682.out | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-)
common/filter +13 -0
@@ -651,5 +651,18 @@ _filter_bash() sed -e "s/^bash: line 1: /bash: /" } +# coreutils 9.4+ modify the error msg of command 'mv'. To be compitable with +# various coreutils versions, we synchronize the output to the latest version. +# coreutils change was added by this commit: +# commit 3cb862ce5f10db392cc8e6907dd9d888acfa2a30 +# Author: Paul Eggert <[email protected]> +# Date: Sat Jul 22 13:39:17 2023 -0700 +# +# mv: better diagnostic for 'mv dir x' failure +_filter_mv_err_msg() +{ + sed -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" +} + # make sure this script returns success /bin/true
tests/generic/245 +4 -5
@@ -29,12 +29,9 @@ _cleanup() # According to the rename(2) manpage you can get either EEXIST or ENOTEMPTY as an # error for trying to rename a non-empty directory, so just catch the error for # ENOTMEMPTY and replace it with the EEXIST output so that either result passes -# Also, mv v9.4+ modified error message when a nonempty destination directory fails -# to be overwriteen _filter_directory_not_empty() { - sed -e "s,Directory not empty,File exists,g" \ - -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" + sed -e "s,Directory not empty,File exists,g" }
@@ -46,7 +43,9 @@ touch $dir/aa/1 mkdir $dir/ab/aa touch $dir/ab/aa/2 -mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir | _filter_directory_not_empty +# Also, mv v9.4+ modified error message when a nonempty destination directory fails +# to be overwriteen, now use _filter_mv_err_msg to ignore the difference +mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir | _filter_directory_not_empty | _filter_mv_err_msg status=0 exit $status
tests/generic/682 +1 -1
@@ -62,7 +62,7 @@ for ((i = 0; i < dirents; i++)); do name=$(printf "y%0254d" $i) ln $scratchfile $stagedir/$name su - "$qa_user" -c "mv $stagedir/$name $scratchdir/$name" 2>&1 | \ - _filter_scratch | sed -e 's/y[0-9]*/yXXX/g' + _filter_mv_err_msg | _filter_scratch | sed -e 's/y[0-9]*/yXXX/g' test "${PIPESTATUS[0]}" -ne 0 && break done repquota -upn $SCRATCH_MNT >> $seqres.full
tests/generic/682.out +1 -1
@@ -1,3 +1,3 @@ QA output created by 682 -mv: cannot move 'SCRATCH_MNT/staging/yXXX' to 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded +mv: cannot overwrite 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded Silence is golden
Signature · 1 line
2.19.1.6.gb485710b