* coreutils 7.0 already has the backwards compatibility patch for old
Linux kernels. svn path=/nixpkgs/branches/stdenv-updates/; revision=13875
This commit is contained in:
parent
6927ec314e
commit
88c502217b
|
@ -12,9 +12,6 @@ stdenv.mkDerivation rec {
|
|||
|
||||
buildInputs = stdenv.lib.optional aclSupport acl;
|
||||
|
||||
# Support older Linux kernels.
|
||||
patches = [ ./setting-time-backward-compatibility.patch ];
|
||||
|
||||
meta = {
|
||||
homepage = http://www.gnu.org/software/coreutils/;
|
||||
description = "The basic file, shell and text manipulation utilities of the GNU operating system";
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
now hat glibc-2.6 declares futimens.
|
||||
http://lists.gnu.org/archive/html/bug-gnulib/2007-05/msg00089.html
|
||||
|
||||
diff -ru cpio-2.7.orig/lib/utimens.c cpio-2.7/lib/utimens.c
|
||||
--- cpio-2.7.orig/lib/utimens.c 2007-05-20 21:23:57.000000000 +0900
|
||||
+++ cpio-2.7/lib/utimens.c 2007-05-21 08:40:22.000000000 +0900
|
||||
@@ -73,7 +73,7 @@
|
||||
Return 0 on success, -1 (setting errno) on failure. */
|
||||
|
||||
int
|
||||
-futimens (int fd ATTRIBUTE_UNUSED,
|
||||
+gl_futimens (int fd ATTRIBUTE_UNUSED,
|
||||
char const *file, struct timespec const timespec[2])
|
||||
{
|
||||
/* There's currently no interface to set file timestamps with
|
||||
@@ -166,5 +166,5 @@
|
||||
int
|
||||
utimens (char const *file, struct timespec const timespec[2])
|
||||
{
|
||||
- return futimens (-1, file, timespec);
|
||||
+ return gl_futimens (-1, file, timespec);
|
||||
}
|
||||
diff -ru cpio-2.7.orig/lib/utimens.h cpio-2.7/lib/utimens.h
|
||||
--- cpio-2.7.orig/lib/utimens.h 2007-05-20 21:23:57.000000000 +0900
|
||||
+++ cpio-2.7/lib/utimens.h 2007-05-21 08:39:57.000000000 +0900
|
||||
@@ -1,3 +1,3 @@
|
||||
#include "timespec.h"
|
||||
-int futimens (int, char const *, struct timespec const [2]);
|
||||
+int gl_futimens (int, char const *, struct timespec const [2]);
|
||||
int utimens (char const *, struct timespec const [2]);
|
||||
diff -ru coreutils-6.9.orig/src/copy.c coreutils-6.9/src/copy.c
|
||||
--- coreutils-6.9.orig/src/copy.c 2007-05-21 09:27:22.000000000 +0900
|
||||
+++ coreutils-6.9/src/copy.c 2007-05-21 09:27:47.000000000 +0900
|
||||
@@ -623,7 +623,7 @@
|
||||
timespec[0] = get_stat_atime (src_sb);
|
||||
timespec[1] = get_stat_mtime (src_sb);
|
||||
|
||||
- if (futimens (dest_desc, dst_name, timespec) != 0)
|
||||
+ if (gl_futimens (dest_desc, dst_name, timespec) != 0)
|
||||
{
|
||||
error (0, errno, _("preserving times for %s"), quote (dst_name));
|
||||
if (x->require_preserve)
|
||||
diff -ru coreutils-6.9.orig/src/touch.c coreutils-6.9/src/touch.c
|
||||
--- coreutils-6.9.orig/src/touch.c 2007-05-21 09:27:22.000000000 +0900
|
||||
+++ coreutils-6.9/src/touch.c 2007-05-21 09:27:57.000000000 +0900
|
||||
@@ -182,7 +182,7 @@
|
||||
t = timespec;
|
||||
}
|
||||
|
||||
- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
|
||||
+ ok = (gl_futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
|
||||
|
||||
if (fd == STDIN_FILENO)
|
||||
{
|
|
@ -1,114 +0,0 @@
|
|||
--- coreutils-6.12/lib/utimens.c 2008-05-29 09:21:57.000000000 -0400
|
||||
+++ lib/utimens.c 2008-06-07 11:36:50.000000000 -0400
|
||||
@@ -96,20 +96,42 @@
|
||||
#endif
|
||||
|
||||
/* POSIX 200x added two interfaces to set file timestamps with
|
||||
- nanosecond resolution. */
|
||||
+ nanosecond resolution. We provide a fallback for ENOSYS (for
|
||||
+ example, compiling against Linux 2.6.25 kernel headers and glibc
|
||||
+ 2.7, but running on Linux 2.6.18 kernel). */
|
||||
#if HAVE_UTIMENSAT
|
||||
if (fd < 0)
|
||||
- return utimensat (AT_FDCWD, file, timespec, 0);
|
||||
+ {
|
||||
+ int result = utimensat (AT_FDCWD, file, timespec, 0);
|
||||
+#ifdef __linux__
|
||||
+ /* Work around what might be a kernel bug:
|
||||
+ http://bugzilla.redhat.com/442352
|
||||
+ http://bugzilla.redhat.com/449910
|
||||
+ It appears that utimensat can mistakenly return 280 rather
|
||||
+ than 0 to indicate success.
|
||||
+ FIXME: remove in 2010 or whenever the offending kernels
|
||||
+ are no longer in common use. */
|
||||
+ if (0 < result)
|
||||
+ result = 0;
|
||||
+#endif
|
||||
+
|
||||
+ if (result == 0 || errno != ENOSYS)
|
||||
+ return result;
|
||||
+ }
|
||||
#endif
|
||||
#if HAVE_FUTIMENS
|
||||
- return futimens (fd, timespec);
|
||||
-#else
|
||||
+ {
|
||||
+ int result = futimens (fd, timespec);
|
||||
+ if (result == 0 || errno != ENOSYS)
|
||||
+ return result;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
/* The platform lacks an interface to set file timestamps with
|
||||
nanosecond resolution, so do the best we can, discarding any
|
||||
fractional part of the timestamp. */
|
||||
{
|
||||
-# if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES
|
||||
+#if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES
|
||||
struct timeval timeval[2];
|
||||
struct timeval const *t;
|
||||
if (timespec)
|
||||
@@ -125,9 +147,9 @@
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
-# if HAVE_FUTIMESAT
|
||||
+# if HAVE_FUTIMESAT
|
||||
return futimesat (AT_FDCWD, file, t);
|
||||
-# endif
|
||||
+# endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -141,21 +163,21 @@
|
||||
worth optimizing, and who knows what other messed-up systems
|
||||
are out there? So play it safe and fall back on the code
|
||||
below. */
|
||||
-# if HAVE_FUTIMESAT
|
||||
+# if HAVE_FUTIMESAT
|
||||
if (futimesat (fd, NULL, t) == 0)
|
||||
return 0;
|
||||
-# elif HAVE_FUTIMES
|
||||
+# elif HAVE_FUTIMES
|
||||
if (futimes (fd, t) == 0)
|
||||
return 0;
|
||||
-# endif
|
||||
+# endif
|
||||
}
|
||||
-# endif /* HAVE_FUTIMESAT || HAVE_WORKING_UTIMES */
|
||||
+#endif /* HAVE_FUTIMESAT || HAVE_WORKING_UTIMES */
|
||||
|
||||
if (!file)
|
||||
{
|
||||
-# if ! (HAVE_FUTIMESAT || (HAVE_WORKING_UTIMES && HAVE_FUTIMES))
|
||||
+#if ! (HAVE_FUTIMESAT || (HAVE_WORKING_UTIMES && HAVE_FUTIMES))
|
||||
errno = ENOSYS;
|
||||
-# endif
|
||||
+#endif
|
||||
|
||||
/* Prefer EBADF to ENOSYS if both error numbers apply. */
|
||||
if (errno == ENOSYS)
|
||||
@@ -170,9 +192,9 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
-# if HAVE_WORKING_UTIMES
|
||||
+#if HAVE_WORKING_UTIMES
|
||||
return utimes (file, t);
|
||||
-# else
|
||||
+#else
|
||||
{
|
||||
struct utimbuf utimbuf;
|
||||
struct utimbuf const *ut;
|
||||
@@ -187,9 +209,8 @@
|
||||
|
||||
return utime (file, ut);
|
||||
}
|
||||
-# endif /* !HAVE_WORKING_UTIMES */
|
||||
+#endif /* !HAVE_WORKING_UTIMES */
|
||||
}
|
||||
-#endif /* !HAVE_FUTIMENS */
|
||||
}
|
||||
|
||||
/* Set the access and modification time stamps of FILE to be
|
||||
|
Loading…
Reference in a new issue