bug-coreutils
[Top][All Lists]
Advanced

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

Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference


From: Eric Blake
Subject: Re: coreutils-8.3: test failed: ls/stat-dtype and touch/no-dereference
Date: Fri, 08 Jan 2010 11:55:22 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

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             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]