* gnulib: Update submodule to latest.
[coreutils.git] / tests / ls / inode
blobb5ddc8c9a81d99837528ae59b90ce0f6108fe55c
1 #!/bin/sh
2 # Make sure that ls -i works properly on symlinks.
4 # Copyright (C) 2003, 2006-2008 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
20 set -x
21 ls --version
24 . $srcdir/test-lib.sh
26 touch f || framework_failure
27 ln -s f slink || framework_failure
29 fail=0
31 # When listed explicitly:
33 set x `ls -Ci f slink`; shift
34 test $# = 4 || fail=1
35 # The inode numbers should differ.
36 test "$1" != "$3" || fail=1
38 set x `ls -CLi f slink`; shift
39 test $# = 4 || fail=1
40 # With -L, they must be the same.
41 test "$1" = "$3" || fail=1
43 set x `ls -CHi f slink`; shift
44 test $# = 4 || fail=1
45 # With -H, they must be the same, too, from the command line.
46 # Note that POSIX says -H must make ls dereference only
47 # symlinks (specified on the command line) to directories,
48 # but the historical BSD meaning of -H is to dereference
49 # any symlink given on the command line. For compatibility GNU ls
50 # implements the BSD semantics.
51 test "$1" = "$3" || fail=1
53 # When listed from a directory:
55 set x `ls -Ci`; shift
56 test $# = 4 || fail=1
57 # The inode numbers should differ.
58 test "$1" != "$3" || fail=1
60 set x `ls -CLi`; shift
61 test $# = 4 || fail=1
62 # With -L, they must be the same.
63 test "$1" = "$3" || fail=1
65 set x `ls -CHi`; shift
66 test $# = 4 || fail=1
67 # With -H, they must be different from inside a directory.
68 test "$1" != "$3" || fail=1
70 Exit $fail