b61beb4bba8e691a22df88112bac50840cd824d0
[platform/upstream/coreutils.git] / tests / touch / dangling-symlink
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.
4
5 if test "$VERBOSE" = yes; then
6   set -x
7   touch --version
8 fi
9
10 rm -f touch-target t-symlink
11 ln -s touch-target t-symlink
12 fail=0
13
14 # This used to infloop.
15 touch t-symlink || fail=1
16
17 test -f touch-target || fail=1
18 rm -f touch-target t-symlink
19
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
33           ;;
34       esac
35       ;;
36   esac
37 fi
38
39 exit $fail