generic/681 and generic/682 fixes
v2 cover generic/681 and generic/682 fixes
A couple of fixes on g/68[12].
v2:
- add Andrey's rvb in first patch (no changes)
- consolidate g/245 and g/682 mv filter into common/filter
Anthony Iliopoulos (2):
generic/68[12]: use the dir blocksize for xfs filesystems generic/682: update and fix-up golden output
common/filter | 14 ++++++++++++++ common/rc | 11 +++++++++++ tests/generic/245 | 14 +------------- tests/generic/681 | 2 +- tests/generic/682 | 4 ++-- tests/generic/682.out | 2 +- 6 files changed, 30 insertions(+), 17 deletions(-)
Signature · 1 line
2.41.0
PATCH v2 1/2 generic/68[12]: use the dir blocksize for xfs filesystems
The tests are using the filesystem block size for calculating the number of dirents required to fill a 2-block directory. For v4 xfs filesystems formatted with fs blocksize of 512 bytes this is failing, as the tests do not take into account that the directory block size is not always equal to the filesystem block size. As such, the tests never go over quota, and even if they did there is no hard block limit being set (due to 512 / 1024 = 0 calculation in setquota).
Use the directory blocksize instead of the filesystem blocksize, when the fstype under test is xfs.
---
v2: add rvb
common/rc | 11 +++++++++++ tests/generic/681 | 2 +- tests/generic/682 | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-)
common/rc +11 -0
@@ -4719,6 +4719,17 @@ _get_block_size() stat -f -c %S $1 } +# Obtain the directory block size of an fs. +_get_dir_block_size() +{ + case "$FSTYP" in + xfs) + _xfs_get_dir_blocksize $1 ;; + *) + _get_block_size $1 ;; + esac +} + # Require that the fundamental allocation unit of a file is the same as the # filesystem block size. The sole parameter must be the root dir of a # filesystem.
tests/generic/681 +1 -1
@@ -30,7 +30,7 @@ _scratch_mkfs > "$seqres.full" 2>&1 _qmount_option usrquota _qmount -blocksize=$(_get_block_size $SCRATCH_MNT) +blocksize=$(_get_dir_block_size $SCRATCH_MNT) scratchdir=$SCRATCH_MNT/dir scratchfile=$SCRATCH_MNT/file mkdir $scratchdir
tests/generic/682 +1 -1
@@ -30,7 +30,7 @@ _scratch_mkfs > "$seqres.full" 2>&1 _qmount_option usrquota _qmount -blocksize=$(_get_block_size $SCRATCH_MNT) +blocksize=$(_get_dir_block_size $SCRATCH_MNT) scratchdir=$SCRATCH_MNT/dir scratchfile=$SCRATCH_MNT/file stagedir=$SCRATCH_MNT/staging
Signature · 1 line
2.41.0
PATCH v2 2/2 generic/682: update and fix-up golden output
In reply to Anthony Iliopouloscoreutils v9.4 introduced a change in the error output of mv under certain errno values via commit 3cb862ce5f10 ("mv: better diagnostic for 'mv dir x' failure"), which broke the golden output.
Update golden output to match the change, and further add an output filter to avoid having the test fail on environments that ran with an older coreutils release, taken from commit d9323ad7a05e ("generic/245:
Filter mv error message").
---
v2: consolidate g/245 and g/682 mv filter into common/filter
common/filter | 14 ++++++++++++++ tests/generic/245 | 14 +------------- tests/generic/682 | 2 +- tests/generic/682.out | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-)
common/filter +14 -0
@@ -481,6 +481,20 @@ _filter_mv() sed -e "s/^renamed //" } +# 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, coreutils v9.4 modified the error message when a nonempty +# destination directory fails to be overwritten, filter the output +# accordingly. +_filter_mv_output() +{ + sed -e "s,Directory not empty,File exists,g" \ + -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" +} + # New stat(1) uses statx(2) _filter_stat() {
tests/generic/245 +1 -13
@@ -26,18 +26,6 @@ _cleanup() rm -rf $dir } -# 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" -} - - mkdir $dir mkdir $dir/aa
@@ -46,7 +34,7 @@ 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 +mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir | _filter_mv_output 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_scratch | _filter_mv_output | 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.41.0
Re: [PATCH v2 2/2] generic/682: update and fix-up golden output
Quoted 4 lines · Anthony Iliopoulos
coreutils v9.4 introduced a change in the error output of mv under certain errno values via commit
3cb862ce5f10("mv: better diagnostic for 'mv dir x' failure"), which broke the golden output.
Quoted 8 lines
Update golden output to match the change, and further add an output filter to avoid having the test fail on environments that ran with an older coreutils release, taken from commit
d9323ad7a05e("generic/245:
Filter mv error message").Signed-off-by Anthony Iliopoulos <[email protected]>---
v2: consolidate g/245 and g/682 mv filter into common/filter
Thanks, this version looks good to me, I'll merge it. But if you're not hurry, it won't be in the release of this week (will be in next release), due to the release of this week is a republish of old v2024.02.04 which was abandoned, I hope to do as few updates as possible on it, for safe :)
Thanks,
Zorro
Quoted 90 lines
common/filter | 14 ++++++++++++++ tests/generic/245 | 14 +------------- tests/generic/682 | 2 +- tests/generic/682.out | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-)common/filter +14
-0@@ -481,6 +481,20 @@ _filter_mv() sed -e "s/^renamed //" } +# 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, coreutils v9.4 modified the error message when a nonempty +# destination directory fails to be overwritten, filter the output +# accordingly. +_filter_mv_output() +{ + sed -e "s,Directory not empty,File exists,g" \ + -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" +} + # New stat(1) uses statx(2) _filter_stat() {tests/generic/245 +1
-13@@ -26,18 +26,6 @@ _cleanup() rm -rf $dir } -# 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" -} - - mkdir $dir mkdir $dir/aa@@ -46,7 +34,7 @@ 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 +mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir | _filter_mv_output status=0 exit $statustests/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_scratch | _filter_mv_output | sed -e 's/y[0-9]*/yXXX/g' test "${PIPESTATUS[0]}" -ne 0 && break done repquota -upn $SCRATCH_MNT >> $seqres.fulltests/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 goldenSignature · 1 line
2.41.0