bug-coreutils
[Top][All Lists]
Advanced

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

[PATCH] cp: ignore obscure failure to preserve symlink time stamps,


From: Jim Meyering
Subject: [PATCH] cp: ignore obscure failure to preserve symlink time stamps,
Date: Mon, 24 Aug 2009 08:34:01 +0200

The "preserve symlink time stamps" feature in coreutils-7.5
is causing trouble in Fedora's build system,

    http://thread.gmane.org/gmane.linux.redhat.fedora.devel/119834

because they use a kernel without utimensat support, yet configured/built
coreutils-7.5 in an environment that suggests (via link tests) that the
function is available.  Here is the fix I expect to push soon:

>From 57d640722e04352a468cc595b0b94dbceaec4871 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
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 |    8 +++++++-
 2 files changed, 13 insertions(+), 1 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..8fc4b68 100644
--- 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;
 #else
   /* Don't set errno=ENOTSUP here as we don't want
      to output an error message for this case.  */
--
1.6.4.378.g88f2f




reply via email to

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