@@ -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 <eggert@cs.ucla.edu>
+# 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
@@ -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
@@ -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
@@ -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
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. Signed-off-by: Ferry Meng <mengferry@linux.alibaba.com> --- common/filter | 13 +++++++++++++ tests/generic/245 | 9 ++++----- tests/generic/682 | 2 +- tests/generic/682.out | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-)