Fixed the hard-link check again, adding a comment as to
authorWayne Davison <wayned@samba.org>
Tue, 19 Feb 2008 01:16:08 +0000 (17:16 -0800)
committerWayne Davison <wayned@samba.org>
Tue, 19 Feb 2008 01:16:08 +0000 (17:16 -0800)
why it is coded the way it is.

testsuite/itemize.test

index 636751e..0b7300c 100644 (file)
@@ -26,13 +26,15 @@ ln -s ../bar/baz/rsync "$fromdir/foo/sym"
 umask 022
 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
 
-# Check if the OS can hard-link symlinks or not
-if ln "$fromdir/foo/sym" "$to2dir" 2>/dev/null; then
+# Check if the OS can hard-link symlinks or not.
+# (Note: the link we check MUST NOT point to a valid file!)
+ln -s no-such-dir "$to2dir"
+if ln "$to2dir" "$to2dir.test" 2>/dev/null; then
     L=hL
 else
     L=cL
 fi
-rm -f "$to2dir"
+rm -f "$to2dir" "$to2dir.test"
 
 # Check if rsync can preserve time on symlinks
 case "$RSYNC" in