4 # Copyright (C) 2009 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 if test "$VERBOSE" = yes; then
27 # ===================================================
28 # ensure -s silently overrides -L, -P
29 touch a || framework_failure
30 ln -L -s a symlink1 || fail=1
31 ln -P -s symlink1 symlink2 || fail=1
32 ln -s -L -P symlink2 symlink3 || fail=1
34 # ===================================================
35 # ensure that -L follows symlinks, and overrides -P
36 ln -P -L symlink3 hard-to-a || fail=1
37 ls=`ls -lG hard-to-a`x
40 *'hard-to-a -> '*x) fail=1 ;;
41 *) framework_failure ;;
44 # ===================================================
45 # ensure that -P links (or at least duplicates) symlinks, and overrides -L
46 ln -L -P symlink3 hard-to-3 || fail=1
47 ls=`ls -lG hard-to-3`x
49 *'hard-to-3 -> symlink2x') ;;
50 *'hard-to-3x') fail=1 ;;
51 *'hard-to-3 -> '*x) fail=1 ;;
52 *) framework_failure ;;
55 # ===================================================
56 # Create a hard link to a dangling symlink.
57 ln -s /no-such-dir || framework_failure
58 ln -L no-such-dir hard-to-dangle 2>err && fail=1
60 *' accessing `no-such-dir'\':*) ;;
63 ln -P no-such-dir hard-to-dangle || fail=1
65 # ===================================================
66 # Create a hard link to a symlink to a directory.
67 mkdir d || framework_failure
68 ln -s d link-to-dir || framework_failure
69 ln -L link-to-dir hard-to-dir-link 2>err && fail=1
71 *': `link-to-dir'\'': hard link not allowed for directory'*) ;;
74 ln -P link-to-dir/ hard-to-dir-link 2>err && fail=1
76 *': `link-to-dir/'\'': hard link not allowed for directory'*) ;;
79 ln -P link-to-dir hard-to-dir-link || fail=1