Tizen 2.0 Release
[external/tizen-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 # Copyright (C) 1999, 2000 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 # 02110-1301, USA.
21
22 if test "$VERBOSE" = yes; then
23   set -x
24   touch --version
25 fi
26
27 rm -f touch-target t-symlink
28 ln -s touch-target t-symlink
29 fail=0
30
31 # This used to infloop.
32 touch t-symlink || fail=1
33
34 test -f touch-target || fail=1
35 rm -f touch-target t-symlink
36
37 if test $fail = 1; then
38   case $host_triplet in
39     *linux-gnu*)
40       case "`uname -r`" in
41         2.3.9[0-9]*)
42           cat 1>&2 <<EOF
43 ====================================================
44 $0: WARNING!!!
45 This version of the Linux kernel causes touch to fail
46 when operating on dangling symlinks.
47 ====================================================
48 EOF
49           exit 77
50           ;;
51       esac
52       ;;
53   esac
54 fi
55
56 exit $fail