3 if test "$VERBOSE" = yes; then
10 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
11 trap '(exit $?); exit' 1 2 13 15
14 mkdir
$tmp || framework_failure
=1
15 cd $tmp || framework_failure
=1
19 ld
=tln-symlink-to-subdir
23 # Create a simple symlink with both source and destination files
24 # in current directory.
25 touch $f || framework_failure
=1
26 rm -f $t || framework_failure
=1
31 # Create a symlink with source file and explicit destination directory/file.
32 touch $f || framework_failure
=1
33 rm -rf $d || framework_failure
=1
34 mkdir
$d || framework_failure
=1
35 ln -s ..
/$f $d/$t || fail
=1
36 test -f $d/$t || fail
=1
39 # Create a symlink with source file and destination directory.
40 touch $f || framework_failure
=1
41 rm -rf $d || framework_failure
=1
42 mkdir
$d || framework_failure
=1
43 ln -s ..
/$f $d || fail
=1
44 test -f $d/$f || fail
=1
47 # Make sure we get a failure with existing dest without -f option
48 touch $t || framework_failure
=1
49 # FIXME: don't ignore the error message but rather test
50 # it to make sure it's the right one.
51 ln -s $t $t 2> /dev
/null
&& fail
=1
54 # Make sure -sf fails when src and dest are the same
55 touch $t || framework_failure
=1
56 ln -sf $t $t 2> /dev
/null
&& fail
=1
59 # Create a symlink with source file and no explicit directory
60 rm -rf $d || framework_failure
=1
61 mkdir
$d || framework_failure
=1
62 touch $d/$f || framework_failure
=1
67 # Create a symlink with source file and destination symlink-to-directory.
68 rm -rf $d $f $ld || framework_failure
=1
69 touch $f || framework_failure
=1
70 mkdir
$d || framework_failure
=1
72 ln -s ..
/$f $ld || fail
=1
73 test -f $d/$f || fail
=1
76 # Create a symlink with source file and destination symlink-to-directory.
77 # BUT use the new --no-dereference option.
78 rm -rf $d $f $ld || framework_failure
=1
79 touch $f || framework_failure
=1
80 mkdir
$d || framework_failure
=1
83 ln --no-dereference -fs $af $ld || fail
=1
87 # Try to create a symlink with backup where the destination file exists
88 # and the backup file name is a hard link to the destination file.
89 touch a b || framework_failure
=1
90 ln b b~ || framework_failure
=1
91 ln -f --b=simple a b || fail
=1
93 # ===================================================
94 # determine if link(2) follows symlinks on this system
95 touch a || framework_failure
=1
96 ln -s a symlink || framework_failure
=1
97 ln symlink hard-to-sym
> /dev
/null
2>&1 || framework_failure
=1
98 ls=`ls -lG hard-to-sym`x
100 *'hard-to-symx') link_follows_symlink
=yes ;;
101 *'hard-to-sym -> ax') link_follows_symlink
=no
;;
102 *) framework_failure
=1 ;;
105 if test $link_follows_symlink = no
; then
106 # Create a hard link to a dangling symlink.
107 # This is not portable. At least sunos4.1.4 and OpenBSD 2.3 fail this test.
109 # ln: cannot create hard link `hard-to-dangle' to `no-such-dir': \
110 # No such file or directory
112 ln -s /no-such-dir || fail
=1
113 ln no-such-dir hard-to-dangle
> /dev
/null
2>&1 || fail
=1
115 rm -rf a symlink hard-to-sym hard-to-dangle
116 # ===================================================
118 # Make sure ln can make simple backups.
119 # This was fixed in 4.0.34. Broken in 4.0r.
120 for cmd
in ln cp mv ginstall
; do
122 touch a x || framework_failure
=1
123 $cmd --backup=simple
--suffix=.orig x a || fail
=1
124 test -f a.orig || fail
=1
127 # ===================================================
129 if test $framework_failure = 1; then
130 echo 'failure in testing framework' 1>&2