GNU bug report logs -
#8419
cp -au : New hard links in source becomes new files at destination when using cp -au
Previous Next
Full log
View this message in rfc822 format
Actually I'm wondering now whether the new code
should be unconditionally replacing the dest?
What if the dest is a separate newer file?
I.E. I think the following amended test should pass?
Also what about backups if the separate file is older?
diff --git a/tests/cp/preserve-link b/tests/cp/preserve-link
index d0da873..cee5ec0 100755
--- a/tests/cp/preserve-link
+++ b/tests/cp/preserve-link
@@ -28,13 +28,26 @@ same_inode()
mkdir -p s t/s || framework_failure_
touch s/f t/s/f || framework_failure_
+
+# a non existing link must be linked in the dest tree
ln s/f s/link || framework_failure_
+# an existing link must be updated
+ln s/f s/linke || framework_failure_
+ln t/s/f t/s/linke || framework_failure_
+
+# a updated link must not be overwritten
+ln s/f s/linku || framework_failure_
+touch -d "+2 hour" t/s/linku || framework_failure_
+
# This must create a hard link, t/s/link, to the existing file, t/s/f.
# With cp from coreutils-8.12 and prior, it would mistakenly copy
# the file rather than creating the link.
+touch -d "+1 hour" s/f || framework_failure_
cp -au s t || fail=1
same_inode t/s/f t/s/link || fail=1
+same_inode t/s/f t/s/linke || fail=1
+same_inode t/s/f t/s/linku && fail=1
Exit $fail
This bug report was last modified 13 years and 306 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.