FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] generic/245: Filter mv error message
@ 2023-10-05  3:42 Su Yue
  2023-10-18 14:08 ` Zorro Lang
  0 siblings, 1 reply; 2+ messages in thread
From: Su Yue @ 2023-10-05  3:42 UTC (permalink / raw)
  To: fstests; +Cc: l, Su Yue

Coreutils commit 3cb862ce5f10 ( mv: better diagnostic for 'mv dir x' failure)
was released in v9.4, changed the error message from
'mv: cannot move 'b/t' to 'a/t': Directory not empty' to
'mv: cannot overwrite 'a/t': Directory not empty' in case of
EDQUOT/EEXIST/EISDIR/EMLINK/ENOSPC/ENOTEMPTY/ETXTBSY.

The change breaks generic/245 due to the mismatched output:

generic/245 1s ... - output mismatch (see /root/xfstests-dev/results//generic/245.out.bad)
    --- tests/generic/245.out   2023-10-05 11:15:21.124295738 +0800
    +++ /root/xfstests-dev/results//generic/245.out.bad 2023-10-05 11:15:23.456315468 +0800
    @@ -1,2 +1,2 @@
    QA output created by 245
    -mv: cannot move 'TEST_DIR/test-mv/ab/aa/' to 'TEST_DIR/test-mv/aa': File exists
    +mv: cannot overwrite 'TEST_DIR/test-mv/aa': File exists
    ...
    (Run 'diff -u /root/xfstests-dev/tests/generic/245.out /root/xfstests-dev/results//generic/245.out.bad'  to see the entire diff)

Filter out the common part of mv error messages to fix the test.

Signed-off-by: Su Yue <glass.su@suse.com>
---
 tests/generic/245     | 4 +++-
 tests/generic/245.out | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/generic/245 b/tests/generic/245
index e2d5c926e906..31f9dd1873b6 100755
--- a/tests/generic/245
+++ b/tests/generic/245
@@ -29,9 +29,11 @@ _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"
+	sed -e "s,Directory not empty,File exists,g" -e "s/.* '\(.*\)':\(.*\)/mv: '\1':\2/"
 }
  
 
diff --git a/tests/generic/245.out b/tests/generic/245.out
index f5b5f182619d..fb7f0f7908e7 100644
--- a/tests/generic/245.out
+++ b/tests/generic/245.out
@@ -1,2 +1,2 @@
 QA output created by 245
-mv: cannot move 'TEST_DIR/test-mv/ab/aa/' to 'TEST_DIR/test-mv/aa': File exists
+mv: 'TEST_DIR/test-mv/aa': File exists
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] generic/245: Filter mv error message
  2023-10-05  3:42 [PATCH] generic/245: Filter mv error message Su Yue
@ 2023-10-18 14:08 ` Zorro Lang
  0 siblings, 0 replies; 2+ messages in thread
From: Zorro Lang @ 2023-10-18 14:08 UTC (permalink / raw)
  To: Su Yue; +Cc: fstests, l

On Thu, Oct 05, 2023 at 11:42:55AM +0800, Su Yue wrote:
> Coreutils commit 3cb862ce5f10 ( mv: better diagnostic for 'mv dir x' failure)
> was released in v9.4, changed the error message from
> 'mv: cannot move 'b/t' to 'a/t': Directory not empty' to
> 'mv: cannot overwrite 'a/t': Directory not empty' in case of
> EDQUOT/EEXIST/EISDIR/EMLINK/ENOSPC/ENOTEMPTY/ETXTBSY.
> 
> The change breaks generic/245 due to the mismatched output:
> 
> generic/245 1s ... - output mismatch (see /root/xfstests-dev/results//generic/245.out.bad)
>     --- tests/generic/245.out   2023-10-05 11:15:21.124295738 +0800
>     +++ /root/xfstests-dev/results//generic/245.out.bad 2023-10-05 11:15:23.456315468 +0800
>     @@ -1,2 +1,2 @@
>     QA output created by 245
>     -mv: cannot move 'TEST_DIR/test-mv/ab/aa/' to 'TEST_DIR/test-mv/aa': File exists
>     +mv: cannot overwrite 'TEST_DIR/test-mv/aa': File exists

Thanks for fixing this issue, I hit it too.

>     ...
>     (Run 'diff -u /root/xfstests-dev/tests/generic/245.out /root/xfstests-dev/results//generic/245.out.bad'  to see the entire diff)
> 
> Filter out the common part of mv error messages to fix the test.
> 
> Signed-off-by: Su Yue <glass.su@suse.com>
> ---
>  tests/generic/245     | 4 +++-
>  tests/generic/245.out | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/245 b/tests/generic/245
> index e2d5c926e906..31f9dd1873b6 100755
> --- a/tests/generic/245
> +++ b/tests/generic/245
> @@ -29,9 +29,11 @@ _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"
> +	sed -e "s,Directory not empty,File exists,g" -e "s/.* '\(.*\)':\(.*\)/mv: '\1':\2/"

As the first line uses "," to be the separator, so better to follow it.
And the ".* '\(.*\)':\(.*\)" is too "imprecise", better to give it more
specific strings to match, to avoid it replace something we don't want
to change. So how about:

	sed -e "s,Directory not empty,File exists,g" \
	    -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g"

Thanks,
Zorro


>  }
>   
>  
> diff --git a/tests/generic/245.out b/tests/generic/245.out
> index f5b5f182619d..fb7f0f7908e7 100644
> --- a/tests/generic/245.out
> +++ b/tests/generic/245.out
> @@ -1,2 +1,2 @@
>  QA output created by 245
> -mv: cannot move 'TEST_DIR/test-mv/ab/aa/' to 'TEST_DIR/test-mv/aa': File exists
> +mv: 'TEST_DIR/test-mv/aa': File exists
> -- 
> 2.42.0
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-18 14:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-05  3:42 [PATCH] generic/245: Filter mv error message Su Yue
2023-10-18 14:08 ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox