Author: aurel32
Status: in BTS

--- coreutils-5.2.1.orig/debian/patches/40_cp_link_posix.patch
+++ coreutils-5.2.1/debian/patches/40_cp_link_posix.patch
@@ -0,0 +1,18 @@
+--- coreutils-5.2.1.orig/src/copy.c	2005-09-19 00:35:32.000000000 +0200
++++ coreutils-5.2.1/src/copy.c	2005-09-19 00:34:53.000000000 +0200
+@@ -1411,7 +1411,15 @@
+ 	}
+     }
+ #endif
++/* According to POSIX.1-2001, a call to link() should dereference symlinks. cp 
++   called with the --no-dereference argument should not. */
++#ifdef LINK_FOLLOWS_SYMLINKS
++  /* For kernels that do not follow POSIX, don't call link() and make a copy. */
++  else if (x->hard_link && !(S_ISLNK (src_mode) && x->dereference == DEREF_NEVER))
++#else
++  /* For kernels that follow POSIX, use link() in all cases. */
+   else if (x->hard_link)
++#endif
+     {
+       preserve_metadata = 0;
+       if (link (src_path, dst_path))

