Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
According to Eric Blake on 1/8/2010 11:55 AM: So it seems like this would do the trick (but I have not yet tested it on a system with the mismatch between kernel and glibc, so no ChangeLog yet...) OK to apply before 8.4? -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net From ee6deaa7bc90b26efcc1d23c8b99900d0c027fcc Mon Sep 17 00:00:00 2001 From: Eric Blake e...@byu.net Date: Fri, 8 Jan 2010 12:01:08 -0700 Subject: [PATCH] tests: avoid spurious failure on old kernel * tests/touch/no-dereference: Skip test if utimensat doesn't support symlinks. Reported by Bernhard Voelker. --- tests/touch/no-dereference | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/touch/no-dereference b/tests/touch/no-dereference index 7adacc4..c1a6748 100755 --- a/tests/touch/no-dereference +++ b/tests/touch/no-dereference @@ -48,8 +48,17 @@ grep '^#define HAVE_LUTIMES' $CONFIG_HEADER /dev/null || skip_test_ 'this system lacks the utimensat function' # Changing time of dangling symlink is okay. -touch -h dangling || fail=1 -test -f nowhere fail=1 +# Skip the test if this fails, but the error text corresponds to +# ENOSYS (possible with old kernel but new glibc). +touch -h dangling 2 err +case $? in + 0) test -f nowhere fail=1 + test -s err fail=1;; + 1) grep 'Function not implemented' err \ +skip_test_ 'this system lacks the utimensat function' + fail=1;; + *) fail=1;; +esac # Change the mtime of a symlink. touch -m -h -d 2009-10-10 link || fail=1 -- 1.6.4.2 signature.asc Description: OpenPGP digital signature
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
On 12/01/10 12:59, Eric Blake wrote: According to Eric Blake on 1/8/2010 11:55 AM: So it seems like this would do the trick (but I have not yet tested it on a system with the mismatch between kernel and glibc, so no ChangeLog yet...) OK to apply before 8.4? I had previously acked that: http://lists.gnu.org/archive/html/bug-coreutils/2010-01/msg00109.html Seems safe enough for 8.4 cheers, Pádraig.
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Eric Blake wrote: According to Eric Blake on 1/8/2010 11:55 AM: So it seems like this would do the trick (but I have not yet tested it on a system with the mismatch between kernel and glibc, so no ChangeLog yet...) OK to apply before 8.4? -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net From ee6deaa7bc90b26efcc1d23c8b99900d0c027fcc Mon Sep 17 00:00:00 2001 From: Eric Blake e...@byu.net Date: Fri, 8 Jan 2010 12:01:08 -0700 Subject: [PATCH] tests: avoid spurious failure on old kernel * tests/touch/no-dereference: Skip test if utimensat doesn't support symlinks. Reported by Bernhard Voelker. --- tests/touch/no-dereference | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/touch/no-dereference b/tests/touch/no-dereference index 7adacc4..c1a6748 100755 --- a/tests/touch/no-dereference +++ b/tests/touch/no-dereference @@ -48,8 +48,17 @@ grep '^#define HAVE_LUTIMES' $CONFIG_HEADER /dev/null || skip_test_ 'this system lacks the utimensat function' # Changing time of dangling symlink is okay. -touch -h dangling || fail=1 -test -f nowhere fail=1 +# Skip the test if this fails, but the error text corresponds to +# ENOSYS (possible with old kernel but new glibc). +touch -h dangling 2 err +case $? in + 0) test -f nowhere fail=1 + test -s err fail=1;; + 1) grep 'Function not implemented' err \ +skip_test_ 'this system lacks the utimensat function' + fail=1;; But isn't the above fail=1 is unreachable code, since skip_test_ exits? + *) fail=1;; +esac # Change the mtime of a symlink. touch -m -h -d 2009-10-10 link || fail=1
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Jim Meyering wrote: Eric Blake wrote: According to Eric Blake on 1/8/2010 11:55 AM: So it seems like this would do the trick (but I have not yet tested it on a system with the mismatch between kernel and glibc, so no ChangeLog yet...) OK to apply before 8.4? -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net From ee6deaa7bc90b26efcc1d23c8b99900d0c027fcc Mon Sep 17 00:00:00 2001 From: Eric Blake e...@byu.net Date: Fri, 8 Jan 2010 12:01:08 -0700 Subject: [PATCH] tests: avoid spurious failure on old kernel * tests/touch/no-dereference: Skip test if utimensat doesn't support symlinks. Reported by Bernhard Voelker. --- tests/touch/no-dereference | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/touch/no-dereference b/tests/touch/no-dereference index 7adacc4..c1a6748 100755 --- a/tests/touch/no-dereference +++ b/tests/touch/no-dereference @@ -48,8 +48,17 @@ grep '^#define HAVE_LUTIMES' $CONFIG_HEADER /dev/null || skip_test_ 'this system lacks the utimensat function' # Changing time of dangling symlink is okay. -touch -h dangling || fail=1 -test -f nowhere fail=1 +# Skip the test if this fails, but the error text corresponds to +# ENOSYS (possible with old kernel but new glibc). +touch -h dangling 2 err +case $? in + 0) test -f nowhere fail=1 + test -s err fail=1;; + 1) grep 'Function not implemented' err \ +skip_test_ 'this system lacks the utimensat function' + fail=1;; But isn't the above fail=1 is unreachable code, since skip_test_ exits? Nevermind. My brain engaged seconds after sending. It obviously *is* reachable.
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Voelker, Bernhard wrote: $3 = {d_ino= 289015472, d_off= 4096, d_reclen = 24, d_type = 0 '\0', d_name = s, '\0' repears 254 times} Thanks. That confirms what I suspected: your system's readdir sets d_type for directories, but not for symlinks. What type of file system is that? I *could* try to make the test detect that and skip, but I'm inclined to let it continue to fail. This particular test is a little odd. It'd be best if there were a way to determine portably whether dirent.d_type is valid without using GNU ls to do it. If anyone can suggest a way, please let us know. At least this test does probably add a little test coverage. BTW: why 600?!? mkdir d ln -s . d/s chmod 600 d That is to ensure that ls gets its type information about d/s without using stat-like system calls (i.e., via readdir's d_type member).
RE: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Jim Meyering wrote: Voelker, Bernhard wrote: $3 = {d_ino= 289015472, d_off= 4096, d_reclen = 24, d_type = 0 '\0', d_name = s, '\0' repears 254 times} Thanks. That confirms what I suspected: your system's readdir sets d_type for directories, but not for symlinks. What type of file system is that? It's a rented virtual root server, so I can't choose a different file system type: $ mount | grep / /dev/vzfs on / type reiserfs (rw,usrquota,grpquota) Have a nice day, Berny
RE: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Eric Blake wrote: According to Voelker, Bernhard on 1/8/2010 7:40 AM: Hello, `make check` failed for 2 of 357 tests here: openSUSE 10.3 (X86-64) (inside a 11 hosted virtual machine) kernel 2.6.9-023stab051.3-smp gcc 4.2.1 CPU: Quad-Core AMD Opteron(tm) Processor 2352 Which glibc? glibc-2.6.1 Your kernel is quite old (it predates the utimensat syscall). yes, it's a virtual server at 11.com. The highest version of openSuSE distro they provide is 10.3. Have a nice day, Berny
RE: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Jim Meyering wrote: Volker, you can diagnose this by stepping through ls.c's print_dir function, doing print *next for each entry. see attached. One of those three will be the entry for d/s (others are usually . and ..) and we care about the direct.d_type member. Strangely, I got one for ., .., and one (d_name = '\0'). You can see that 10 corresponds to DT_LNK: (gdb) p (int)DT_LNK $5 = 10 I got the same: (gdb) print (int)DT_LNK $7 = 10 Since the code appears to work as intended with DT_DIR, perhaps your system (or file system) lacks DT_LNK support? How can I check? Thank you and have a nice day, Berny cu-8.3-ls-gdb.log Description: cu-8.3-ls-gdb.log
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Voelker, Bernhard wrote: Jim Meyering wrote: Volker, you can diagnose this by stepping through ls.c's print_dir function, doing print *next for each entry. see attached. Thanks! One of those three will be the entry for d/s (others are usually . and ..) and we care about the direct.d_type member. Strangely, I got one for ., .., and one (d_name = '\0'). You can see that 10 corresponds to DT_LNK: (gdb) p (int)DT_LNK $5 = 10 I got the same: (gdb) print (int)DT_LNK $7 = 10 Since the code appears to work as intended with DT_DIR, perhaps your system (or file system) lacks DT_LNK support? How can I check? (see below) Please repeat, but be sure to execute the assignment before printing the assigned-to value. (gdb) run Starting program: /home/berny/depot/coreutils-8.3/src/ls --file-type d [Thread debugging using libthread_db enabled] [New Thread 0x2a95edcf70 (LWP 28010)] Breakpoint 2 at 0x2a95a0e0c0 Pending breakpoint readdir resolved [Switching to Thread 0x2a95edcf70 (LWP 28010)] Breakpoint 2, 0x002a95a0e0c0 in readdir64 () from /lib64/libc.so.6 (gdb) fin Run till exit from #0 0x002a95a0e0c0 in readdir64 () from /lib64/libc.so.6 print_dir (name=0x623bc0 d, realname=0x0, command_line_arg=true) at ls.c:2506 2506 if (next) (gdb) next 2505 next = readdir (dirp); (gdb) print *next Ahh... our debuggers aren't quite the same. You'll have to use one more next command. The above prints *next *before* the assignment. If you'd used one more next to advance past the assignment, then you would have seen the expected names: ., .., s. $1 = {d_ino = 6437824, d_off = 0, d_reclen = 1, d_type = 0 '\0', d_name = '\0'
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Jim Meyering wrote: Eric Blake wrote: According to Voelker, Bernhard on 1/8/2010 7:40 AM: Hello, `make check` failed for 2 of 357 tests here: openSUSE 10.3 (X86-64) (inside a 11 hosted virtual machine) kernel 2.6.9-023stab051.3-smp gcc 4.2.1 CPU: Quad-Core AMD Opteron(tm) Processor 2352 Which glibc? Your kernel is quite old (it predates the utimensat syscall). Assuming your glibc is new enough to provide the utimensat wrapper (which then fails with ENOSYS given the missing syscall), that would explain this failure: FAIL: touch/no-dereference (exit: 1) + grep '^#define HAVE_UTIMENSAT' /home/berny/depot/coreutils-8.3/lib/config.h + touch -h dangling touch: setting times of `dangling': Function not implemented The test is assuming that because glibc declared utimensat, that it will work. But obviously it doesn't, because your kernel is too old. I don't know of any better way to filter out this test, other than to add logic that skips (rather than fails) if touch dies with ENOSYS. Sounds good to me. FAIL: ls/stat-dtype (exit: 1) = I'm not sure what's failing here; hopefully others can chime in. The test first ensures that ls -p can determine that the just-created c/d is a directory *without* calling stat: (because it's in a directory, c/, that is not searchable) mkdir -p c/d || framework_failure chmod a-x c || framework_failure if test X`ls -p c 21` != Xd/; then skip_test_ '.' is not on a suitable file system for this test fi Your log output suggest that that works fine, since the test was not skipped. However, when we try to do the same thing with a symlink d/s instead of a directory (and using --file-type instead of -p -- I don't know off hand if that matters), it fails: Here's code from the test script: ls --file-type d out || fail=1 cat \EOF exp || fail=1 s@ EOF Here's output from your log: + ls --file-type d ls: cannot access d/s: Permission denied + fail=1 + cat + compare out exp + diff -u out exp --- out 2010-01-08 15:17:22.0 +0100 +++ exp 2010-01-08 15:17:22.0 +0100 @@ -1 +1 @@ -s +s@ + fail=1 It failed on two counts: first, ls exited nonzero. Then the output, s, did not match what was expected: s@. Volker, you can diagnose this by stepping through ls.c's print_dir function, doing print *next for each entry. To be precise, do this: $ cd coreutils/src $ mkdir d ln -s . d/s chmod 600 d $ gdb --args ./ls --file-type d break readdir run fin next print *next continue fin next print *next continue fin next print *next continue One of those three will be the entry for d/s (others are usually . and ..) and we care about the direct.d_type member. I got this: $4 = { d_ino = 1199615, d_off = 899204271, d_reclen = 24, d_type = 10 '\n', d_name = s\000\025\025\n\031\372\022\000\000\000\000\000\377\377\377\177\000\000\000\000\030\000\004..\000\025\004, '\025' repeats 227 times You can see that 10 corresponds to DT_LNK: (gdb) p (int)DT_LNK $5 = 10 Since the code appears to work as intended with DT_DIR, perhaps your system (or file system) lacks DT_LNK support?
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
According to Voelker, Bernhard on 1/8/2010 7:40 AM: Hello, `make check` failed for 2 of 357 tests here: openSUSE 10.3 (X86-64) (inside a 11 hosted virtual machine) kernel 2.6.9-023stab051.3-smp gcc 4.2.1 CPU: Quad-Core AMD Opteron(tm) Processor 2352 Which glibc? Your kernel is quite old (it predates the utimensat syscall). Assuming your glibc is new enough to provide the utimensat wrapper (which then fails with ENOSYS given the missing syscall), that would explain this failure: FAIL: touch/no-dereference (exit: 1) + grep '^#define HAVE_UTIMENSAT' /home/berny/depot/coreutils-8.3/lib/config.h + touch -h dangling touch: setting times of `dangling': Function not implemented The test is assuming that because glibc declared utimensat, that it will work. But obviously it doesn't, because your kernel is too old. I don't know of any better way to filter out this test, other than to add logic that skips (rather than fails) if touch dies with ENOSYS. FAIL: ls/stat-dtype (exit: 1) = I'm not sure what's failing here; hopefully others can chime in. -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net signature.asc Description: OpenPGP digital signature
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Eric Blake wrote: According to Voelker, Bernhard on 1/8/2010 7:40 AM: Hello, `make check` failed for 2 of 357 tests here: openSUSE 10.3 (X86-64) (inside a 11 hosted virtual machine) kernel 2.6.9-023stab051.3-smp gcc 4.2.1 CPU: Quad-Core AMD Opteron(tm) Processor 2352 Which glibc? Your kernel is quite old (it predates the utimensat syscall). Assuming your glibc is new enough to provide the utimensat wrapper (which then fails with ENOSYS given the missing syscall), that would explain this failure: FAIL: touch/no-dereference (exit: 1) + grep '^#define HAVE_UTIMENSAT' /home/berny/depot/coreutils-8.3/lib/config.h + touch -h dangling touch: setting times of `dangling': Function not implemented The test is assuming that because glibc declared utimensat, that it will work. But obviously it doesn't, because your kernel is too old. I don't know of any better way to filter out this test, other than to add logic that skips (rather than fails) if touch dies with ENOSYS. Sounds good to me. FAIL: ls/stat-dtype (exit: 1) = I'm not sure what's failing here; hopefully others can chime in. The test first ensures that ls -p can determine that the just-created c/d is a directory *without* calling stat: (because it's in a directory, c/, that is not searchable) mkdir -p c/d || framework_failure chmod a-x c || framework_failure if test X`ls -p c 21` != Xd/; then skip_test_ '.' is not on a suitable file system for this test fi Your log output suggest that that works fine, since the test was not skipped. However, when we try to do the same thing with a symlink d/s instead of a directory (and using --file-type instead of -p -- I don't know off hand if that matters), it fails: Here's code from the test script: ls --file-type d out || fail=1 cat \EOF exp || fail=1 s@ EOF Here's output from your log: + ls --file-type d ls: cannot access d/s: Permission denied + fail=1 + cat + compare out exp + diff -u out exp --- out 2010-01-08 15:17:22.0 +0100 +++ exp 2010-01-08 15:17:22.0 +0100 @@ -1 +1 @@ -s +s@ + fail=1 It failed on two counts: first, ls exited nonzero. Then the output, s, did not match what was expected: s@.
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
On 08/01/10 16:18, Eric Blake wrote: According to Voelker, Bernhard on 1/8/2010 7:40 AM: FAIL: touch/no-dereference (exit: 1) + grep '^#define HAVE_UTIMENSAT' /home/berny/depot/coreutils-8.3/lib/config.h + touch -h dangling touch: setting times of `dangling': Function not implemented The test is assuming that because glibc declared utimensat, that it will work. But obviously it doesn't, because your kernel is too old. I don't know of any better way to filter out this test, other than to add logic that skips (rather than fails) if touch dies with ENOSYS. Yes we should skip in this case, and there are probably lots of other tests that would need skipping on unsupported operations also. Detecting unsupported generally though may be tricky as I'm not sure can we depend on particular error numbers. Perhaps we could map the names using something like: not_supported() { errnos=$( echo #include errno.h | cpp -dD | grep -E #define E(NOSYS|OPNOTSUPP|NOTSUP|NOTTY) | tr -cd '[:digit:]\n' | tr '\n' '|' | sed 's/|*$//' ) eval case $1 in $errnos) return 0 ;; esac return 1 } Though that depends on cpp and errno.h being present, and is too hacky/slow. Probably a perl snippet using Errno is more appropriate. cheers, Pádraig.
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
According to Pádraig Brady on 1/8/2010 10:13 AM: touch: setting times of `dangling': Function not implemented The test is assuming that because glibc declared utimensat, that it will work. But obviously it doesn't, because your kernel is too old. I don't know of any better way to filter out this test, other than to add logic that skips (rather than fails) if touch dies with ENOSYS. Yes we should skip in this case, and there are probably lots of other tests that would need skipping on unsupported operations also. Detecting unsupported generally though may be tricky as I'm not sure can we depend on particular error numbers. But for this _particular_ test, the error text will always include Function not implemented. Why? Because so far, Linux is the only system where utimensat() exists at link time but where it fails with ENOSYS. All other platforms either lack utimensat, or utimensat succeeds as documented. So it seems like this would do the trick (but I have not yet tested it on a system with the mismatch between kernel and glibc, so no ChangeLog yet...) diff --git a/tests/touch/no-dereference b/tests/touch/no-dereference index 7adacc4..c1a6748 100755 --- a/tests/touch/no-dereference +++ b/tests/touch/no-dereference @@ -48,8 +48,17 @@ grep '^#define HAVE_LUTIMES' $CONFIG_HEADER /dev/null || skip_test_ 'this system lacks the utimensat function' # Changing time of dangling symlink is okay. -touch -h dangling || fail=1 -test -f nowhere fail=1 +# Skip the test if this fails, but the error text corresponds to +# ENOSYS (possible with old kernel but new glibc). +touch -h dangling 2 err +case $? in + 0) test -f nowhere fail=1 + test -s err fail=1;; + 1) grep 'Function not implemented' err \ +skip_test_ 'this system lacks the utimensat function' + fail=1;; + *) fail=1;; +esac # Change the mtime of a symlink. touch -m -h -d 2009-10-10 link || fail=1 -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net signature.asc Description: OpenPGP digital signature
Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
On 08/01/10 18:55, Eric Blake wrote: According to Pádraig Brady on 1/8/2010 10:13 AM: touch: setting times of `dangling': Function not implemented The test is assuming that because glibc declared utimensat, that it will work. But obviously it doesn't, because your kernel is too old. I don't know of any better way to filter out this test, other than to add logic that skips (rather than fails) if touch dies with ENOSYS. Yes we should skip in this case, and there are probably lots of other tests that would need skipping on unsupported operations also. Detecting unsupported generally though may be tricky as I'm not sure can we depend on particular error numbers. But for this _particular_ test, the error text will always include Function not implemented. Why? Because so far, Linux is the only system where utimensat() exists at link time but where it fails with ENOSYS. All other platforms either lack utimensat, or utimensat succeeds as documented. So it seems like this would do the trick (but I have not yet tested it on a system with the mismatch between kernel and glibc, so no ChangeLog yet...) Fair enough. The general method couldn't be used anyway unless tail et. al. were modified to return the actual errno rather than just [01]. cheers, Pádraig.