Re: [PATCH v2 2/2] generic/682: update and fix-up golden output

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Tue, Feb 06, 2024 at 06:36:25PM +0100, Anthony Iliopoulos wrote:
> 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.
> 
> 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 <ailiop@xxxxxxxx>
> ---
> 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 :)

Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx>

Thanks,
Zorro

> 
>  common/filter         | 14 ++++++++++++++
>  tests/generic/245     | 14 +-------------
>  tests/generic/682     |  2 +-
>  tests/generic/682.out |  2 +-
>  4 files changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/common/filter b/common/filter
> index 36d51bd957dd..e7473c9568e9 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -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()
>  {
> diff --git a/tests/generic/245 b/tests/generic/245
> index 81ce4d4e2450..8b8e3e219255 100755
> --- a/tests/generic/245
> +++ b/tests/generic/245
> @@ -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
> diff --git a/tests/generic/682 b/tests/generic/682
> index a51d18338742..b70a4d02e429 100755
> --- a/tests/generic/682
> +++ b/tests/generic/682
> @@ -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
> diff --git a/tests/generic/682.out b/tests/generic/682.out
> index b74708117237..db22d5f60487 100644
> --- a/tests/generic/682.out
> +++ b/tests/generic/682.out
> @@ -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
> -- 
> 2.41.0
> 
> 





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux