Skip to contentSkip to conversation

generic/556: Adequate expected output to touch behavior change

PATCH In review Gabriel Krisman Bertazi 4 participants 4 messages May 18, 2022 – May 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/556: Adequate expected output to touch behavior change

Coreutils commit d435cfc0bc55 ("touch: fix wrong
diagnostic (Bug#48106)"), released in coreutils v9.0, changed the error reported by the tool when openat() fails with EINVAL. Instead of reporting a generic message for the failure of either openat() or the following utimensat(), it now differentiates both failures with different messages.

This change breaks generic/556, which relied on the parsing of that message. This test was originally developed by me on a Debian Buster (coreutils v8.x), so I used the generic error message. Now that I tried to run it on a more modern distro, it reports a different error message, which fails the test.

We could do it in a more flexible way to catch future changes. These are unlikely, and many other parts of fstests just use this generic touch message, so don't bother with it here.

There is no change in behavior on the kernel side, just a broken test. On both older and new distros, the kernel correctly rejects this invalid sequence with -EINVAL, as shown in the strace hunk below:

...
openat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL utimensat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
...

---
 tests/generic/556.out | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/generic/556.out +2 -2
index f9dd9542fb12..12c77a5b0176 100644
@@ -12,5 +12,5 @@ user.foo="bar"
 # file: SCRATCH_MNT/xattrs/x/f1
 user.foo="bar"
 
-touch: setting times of 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
-touch: setting times of 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
+touch: cannot touch 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
+touch: cannot touch 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
Signature · 1 line
2.36.1
#1 lore raw
Quoted 36 lines · Gabriel Krisman Bertazi

Coreutils commit d435cfc0bc55 ("touch: fix wrong
diagnostic (Bug#48106)"), released in coreutils v9.0, changed the error reported by the tool when openat() fails with EINVAL. Instead of reporting a generic message for the failure of either openat() or the following utimensat(), it now differentiates both failures with different messages.

This change breaks generic/556, which relied on the parsing of that message. This test was originally developed by me on a Debian Buster (coreutils v8.x), so I used the generic error message. Now that I tried to run it on a more modern distro, it reports a different error message, which fails the test.

We could do it in a more flexible way to catch future changes. These are unlikely, and many other parts of fstests just use this generic touch message, so don't bother with it here.

There is no change in behavior on the kernel side, just a broken test. On both older and new distros, the kernel correctly rejects this invalid sequence with -EINVAL, as shown in the strace hunk below:

...
openat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL utimensat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
...

---
 tests/generic/556.out | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/generic/556.out +0 -0
index f9dd9542fb12..12c77a5b0176 100644

tests/generic/556.out user.foo="bar" · line 16

Quoted 7 lines
tests/generic/556.out +2 -2
@@ -12,5 +12,5 @@ user.foo="bar"
 # file: SCRATCH_MNT/xattrs/x/f1
 user.foo="bar"
 
-touch: setting times of 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
-touch: setting times of 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
+touch: cannot touch 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
+touch: cannot touch 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument

This would break the test on systems that still have an older version of coreutils, right? For example, currently kvm-xfstests test appliances are based on Debian Bullseye by default, which isn't very old, but it has coreutils 8.32.

Can you filter the output to allow the test to pass with both old and new coreutils versions? Or, find another way to test the same thing without relying on a tool that has changed its output.

- Eric

#2 lore raw
Quoted 49 lines · Eric Biggers
Quoted 36 lines · Gabriel Krisman Bertazi

Coreutils commit d435cfc0bc55 ("touch: fix wrong
diagnostic (Bug#48106)"), released in coreutils v9.0, changed the error reported by the tool when openat() fails with EINVAL. Instead of reporting a generic message for the failure of either openat() or the following utimensat(), it now differentiates both failures with different messages.

This change breaks generic/556, which relied on the parsing of that message. This test was originally developed by me on a Debian Buster (coreutils v8.x), so I used the generic error message. Now that I tried to run it on a more modern distro, it reports a different error message, which fails the test.

We could do it in a more flexible way to catch future changes. These are unlikely, and many other parts of fstests just use this generic touch message, so don't bother with it here.

There is no change in behavior on the kernel side, just a broken test. On both older and new distros, the kernel correctly rejects this invalid sequence with -EINVAL, as shown in the strace hunk below:

...
openat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL utimensat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
...

---
 tests/generic/556.out | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/generic/556.out +0 -0
index f9dd9542fb12..12c77a5b0176 100644

tests/generic/556.out user.foo="bar" · line 16

Quoted 7 lines
tests/generic/556.out +2 -2
@@ -12,5 +12,5 @@ user.foo="bar"
 # file: SCRATCH_MNT/xattrs/x/f1
 user.foo="bar"
 
-touch: setting times of 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
-touch: setting times of 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
+touch: cannot touch 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
+touch: cannot touch 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument

This would break the test on systems that still have an older version of coreutils, right? For example, currently kvm-xfstests test appliances are based on Debian Bullseye by default, which isn't very old, but it has coreutils 8.32.

Quoted 3 lines

Can you filter the output to allow the test to pass with both old and new coreutils versions? Or, find another way to test the same thing without relying on a tool that has changed its output.

Seconded, those of us running ancient distros like Ubuntu 22.04 will need compatibility with 8.32 for a few years yet... ;)

--D

Quoted 1 line

- Eric

#3 lore raw
In reply to Eric Biggers
Quoted 4 lines · Eric Biggers

This would break the test on systems that still have an older version of coreutils, right? For example, currently kvm-xfstests test appliances are based on Debian Bullseye by default, which isn't very old, but it has coreutils 8.32.

Even Debian unstable is still using coreutils 8.32:

https://packages.debian.org/search?keywords=coreutils&searchon=names&suite=all&section=all

Quoted 2 lines

Can you filter the output to allow the test to pass with both old and new coreutils versions?

Gabriel, FYI, the filter functions live in common/filter. There are a large number of them see "git log common/filter" to see how they get added. For a really simple example, please see commit 90d132ee44b7:

common/filter: add _filter_bash()

This is needed to account for bash 5.1 adding line number annotation when executing a command via the -c option and it fails. For example, "bash -c 'echo foo > /'" will cause bash 5.1 to report:

bash: line 1: /: Is a directory

instead of:

bash: /: Is a directory

Cheers,

- Ted