4 # Copyright (C) 2009-2012 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 .
"${srcdir=.}/init.sh"; path_prepend_ ..
/src
23 # ===================================================
24 # ensure -s silently overrides -L, -P
25 touch a || framework_failure_
26 ln -L -s a symlink1 || fail
=1
27 ln -P -s symlink1 symlink2 || fail
=1
28 ln -s -L -P symlink2 symlink3 || fail
=1
30 # ===================================================
31 # ensure that -L follows symlinks, and overrides -P
32 ln -P -L symlink3 hard-to-a || fail
=1
33 ls=`ls -lG hard-to-a`x
36 *'hard-to-a -> '*x
) fail
=1 ;;
37 *) framework_failure_
;;
40 # ===================================================
41 # ensure that -P links (or at least duplicates) symlinks, and overrides -L
42 ln -L -P symlink3 hard-to-3 || fail
=1
43 ls=`ls -lG hard-to-3`x
45 *'hard-to-3 -> symlink2x') ;;
46 *'hard-to-3x') fail
=1 ;;
47 *'hard-to-3 -> '*x
) fail
=1 ;;
48 *) framework_failure_
;;
51 # ===================================================
52 # Create a hard link to a dangling symlink.
53 ln -s /no-such-dir || framework_failure_
54 ln -L no-such-dir hard-to-dangle
2>err
&& fail
=1
56 *" accessing 'no-such-dir'":*) ;;
59 ln -P no-such-dir hard-to-dangle || fail
=1
61 # ===================================================
62 # Create a hard link to a symlink to a directory.
63 mkdir d || framework_failure_
64 ln -s d link-to-dir || framework_failure_
65 ln -L link-to-dir hard-to-dir-link
2>err
&& fail
=1
67 *": 'link-to-dir': hard link not allowed for directory"*) ;;
70 ln -P link-to-dir
/ hard-to-dir-link
2>err
&& fail
=1
72 *": 'link-to-dir/': hard link not allowed for directory"*) ;;
75 ln -P link-to-dir hard-to-dir-link || fail
=1