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

Re: Koji build failure with coreutils-7.5



Jeff Garzik wrote:

> On 08/24/2009 02:26 AM, Jim Meyering wrote:
>> +** Bug fixes
>> +
>> +  cp, mv now ignore failure to preserve a symlink time stamp, when it is
>> +  due to their running on a kernel older than what was implied by headers
>> +  and libraries tested at configure time.
>> +
>
> Yeah, this will be easy to trigger for a while, unfortunately...
>
>
>> --- a/src/copy.c
>> +++ b/src/copy.c
>> @@ -124,7 +124,13 @@ static inline int
>>   utimens_symlink (char const *file, struct timespec const *timespec)
>>   {
>>   #if HAVE_UTIMENSAT
>> -  return utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
>> +  int err = utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
>> +  /* When configuring on a system with new headers and libraries, and
>> +     running on one with a kernel that is old enough to lack the syscall,
>> +     utimensat fails with ENOTSUP.  Ignore that.  */
>> +  if (err&&  errno == ENOSYS)
>> +    err = 0;
>> +  return err;
>
> Seems like the comment (ENOTSUP) needs to be changed to match the code
> (ENOSYS)?

Yes, indeed.  Thanks, Jeff.
I've adjusted that patch to remove the comment mentioning
ENOTSUP in the #else block, too (removed the #else block, actually).

There are too many E{not-supported/not-available} codes.
ENOTSUP is what is "returned" by coreutils/gnulib's lgetfilecon
wrapper, yet some versions fail with errno==ENODATA, hence
the errno_unsupported function, which happens to work also with
xattr stuff.  But not here, since this function fails with ENOSYS.
And I don't want to relax errno_unsupported to accept ENOSYS,
in case some legit utimensat fails with errno==ENODATA.


>From 3f71bc0a318857d43c419b1fa2df28a7de610c1c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Mon, 24 Aug 2009 08:21:47 +0200
Subject: [PATCH] cp: ignore obscure failure to preserve symlink time stamps,

when run on a kernel older than what was implied by headers and
libraries tested at configure time.
* src/copy.c (utimens_symlink): Ignore failure when errno == ENOSYS.
* NEWS (Bug fixes): Mention it.
Reported by Todd Zullinger and Kamil Dudka.
---
 NEWS       |    6 ++++++
 src/copy.c |   15 ++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 2c744b1..c125b31 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ GNU coreutils NEWS                                    -*- outline -*-

 * Noteworthy changes in release ?.? (????-??-??) [?]

+** Bug fixes
+
+  cp, mv now ignore failure to preserve a symlink time stamp, when it is
+  due to their running on a kernel older than what was implied by headers
+  and libraries tested at configure time.
+

 * Noteworthy changes in release 7.5 (2009-08-20) [stable]

diff --git a/src/copy.c b/src/copy.c
index bf9230b..b5cf64c 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -123,13 +123,18 @@ static char const *top_level_dst_name;
 static inline int
 utimens_symlink (char const *file, struct timespec const *timespec)
 {
+  int err = 0;
+
 #if HAVE_UTIMENSAT
-  return utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
-#else
-  /* Don't set errno=ENOTSUP here as we don't want
-     to output an error message for this case.  */
-  return 0;
+  err = utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
+  /* When configuring on a system with new headers and libraries, and
+     running on one with a kernel that is old enough to lack the syscall,
+     utimensat fails with ENOSYS.  Ignore that.  */
+  if (err && errno == ENOSYS)
+    err = 0;
 #endif
+
+  return err;
 }

 /* Perform the O(1) btrfs clone operation, if possible.
--
1.6.4.378.g88f2f


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