.
[coreutils.git] / tests / touch / dangling-symlink
blobb61beb4bba8e691a22df88112bac50840cd824d0
1 #!/bin/sh
2 # Make sure touch can create a file through a dangling symlink.
3 # This was broken in the 4.0[e-i] test releases.
5 if test "$VERBOSE" = yes; then
6 set -x
7 touch --version
8 fi
10 rm -f touch-target t-symlink
11 ln -s touch-target t-symlink
12 fail=0
14 # This used to infloop.
15 touch t-symlink || fail=1
17 test -f touch-target || fail=1
18 rm -f touch-target t-symlink
20 if test $fail = 1; then
21 case $host_triplet in
22 *linux-gnu*)
23 case "`uname -r`" in
24 2.3.9[0-9]*)
25 cat 1>&2 <<EOF
26 ====================================================
27 $0: WARNING!!!
28 This version of the Linux kernel causes touch to fail
29 when operating on dangling symlinks.
30 ====================================================
31 EOF
32 exit 77
34 esac
36 esac
39 exit $fail