+2007-11-01 Jim Meyering <meyering@redhat.com>
+
+ Accommodate FreeBSD 6.1 hard-link-to-symlink differences.
+ * tests/cp/same-file: Detect when linking to a symlink links to
+ the target of the symlink (FreeBSD 6.1 does this, Linux does not),
+ and skip the few tests that would otherwise fail.
+ Redirect output of final comparison to stderr, since all stdout
+ is already redirected.
+
2007-10-31 Jim Meyering <meyering@redhat.com>
Fix a "make distcheck" failure.
VERSION_CONTROL=numbered; export VERSION_CONTROL
+# Determine whether a hard link to a symlink points to the symlink
+# itself or to its referent. For example, the link from FreeBSD6.1
+# does dereference a symlink, but the one from Linux does not.
+ln -s no-such dangling-slink
+ln dangling-slink hard-link > /dev/null 2>&1 \
+ && hard_link_to_symlink_does_the_deref=no \
+ || hard_link_to_symlink_does_the_deref=yes
+rm -f no-such dangling-slink hard-link
+
+test $hard_link_to_symlink_does_the_deref = yes \
+ && remove_these_sed='/^0 -[bf]*l .*sl1 ->/d' \
+ || remove_these_sed='/^ELIDE NO TEST OUTPUT/d'
+
actual=actual-$$
expected=expected-$$
case $args$options in
# These tests are not portable.
# They all involve making a hard link to a symbolic link.
+ # In the past, we've skipped the tests that are not portable,
+ # by doing "continue" here and eliminating the corresponding
+ # expected output lines below. Don't do that anymore.
'symlink foo'-dfl)
continue;;
'symlink foo'-bdl)
'sl1 sl2'-dl)
continue;;
esac
+
+ # cont'd Instead, skip them only on systems for which link does
+ # dereference a symlink. Detect and skip such tests here.
+ case $hard_link_to_symlink_does_the_deref:$args:$options in
+ 'yes:sl1 sl2:-fl')
+ continue ;;
+ 'yes:sl1 sl2:-bl')
+ continue ;;
+ 'yes:sl1 sl2:-bfl')
+ continue ;;
+ esac
+
rm -rf dir
mkdir dir
cd dir
echo
done
-cat <<\EOF > $expected
+cat <<\EOF | sed "$remove_these_sed" > $expected
1 [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
1 -d [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
1 -f [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
fail=0;
-compare $expected $actual || fail=1
+compare $expected $actual 1>&2 || fail=1
(exit $fail); exit $fail