coreutils
[Top][All Lists]
Advanced

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

[PATCH] copy: prefer our hardlink to symlink emulation on OS X 10.10


From: Pádraig Brady
Subject: [PATCH] copy: prefer our hardlink to symlink emulation on OS X 10.10
Date: Thu, 28 May 2015 02:38:57 +0100

* src/copy.c (CAN_HARDLINK_SYMLINKS): Don't enable use of linkat()
on Darwin 14, as the gnulib fallback emulation there doesn't
preserve ownership and timestamps etc.  This fixes a test failure
in tests/cp/link-symlink.sh
* tests/cp/link-deref.sh: Adjust accordingly.
---
 src/copy.c             | 2 +-
 tests/cp/link-deref.sh | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 3af4295..5fe69ea 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -104,7 +104,7 @@ rpl_mkfifo (char const *file, mode_t mode)
 
 /* LINK_FOLLOWS_SYMLINKS is tri-state; if it is -1, we don't know
    how link() behaves, so assume we can't hardlink symlinks in that case.  */
-#if defined HAVE_LINKAT || ! LINK_FOLLOWS_SYMLINKS
+#if (defined HAVE_LINKAT && ! LINKAT_SYMLINK_NOTSUP) || ! LINK_FOLLOWS_SYMLINKS
 # define CAN_HARDLINK_SYMLINKS 1
 #else
 # define CAN_HARDLINK_SYMLINKS 0
diff --git a/tests/cp/link-deref.sh b/tests/cp/link-deref.sh
index 98d2644..b0efb6f 100755
--- a/tests/cp/link-deref.sh
+++ b/tests/cp/link-deref.sh
@@ -19,7 +19,8 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cp
 
-if grep '^#define HAVE_LINKAT 1' "$CONFIG_HEADER" > /dev/null \
+if { grep '^#define HAVE_LINKAT 1' "$CONFIG_HEADER" > /dev/null \
+     && grep '#undef LINKAT_SYMLINK_NOTSUP' "$CONFIG_HEADER" > /dev/null; } \
    || grep '^#define LINK_FOLLOWS_SYMLINKS 0' "$CONFIG_HEADER" > /dev/null; 
then
   # With this config cp will attempt to linkat() to hardlink a symlink.
   # So now double check the current file system supports this operation.
-- 
2.4.1




reply via email to

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