2 # Ensure that the size of a long-named-symlink is > 0.
4 # Copyright (C) 2002, 2003, 2004 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 2 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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 if test "$VERBOSE" = yes; then
27 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
28 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
29 trap '(exit $?); exit $?' 1 2 13 15
32 mkdir -p $tmp || framework_failure=1
33 cd $tmp || framework_failure=1
35 # Determine if `.' is on a local (would non-NFS be sufficient?) file system.
36 # On at least some NFS implementations, symlinks never take up space,
37 df --local . | tail -n +2 > tmp
38 # So if this is a non-local file system, skip the test.
42 echo "$0: skipping this test, since \`.' is on a non-local file system" 1>&2
46 df --type=xfs . | tail -n +2 > tmp
48 # At least on Irix-6.5.19, when using an xfs file system,
49 # each created symlink (name lengths up to 255) would have a size of `0'.
50 echo "$0: skipping this test, since \`.' is on an XFS file system" 1>&2
54 if test $framework_failure = 1; then
55 echo "$0: failure in testing framework" 1>&2
60 symlink_name_lengths='1 15 16 31 32 59 60 63 64 127 128 255 256 511 512 1024'
61 for len in $symlink_name_lengths; do
62 name=`seq 1 $len|tr -c x y |head -c$len`
63 # Record the names of symlinks that are successfully created.
64 ln -fs $name $len > /dev/null 2>&1 \
65 && symlinks="$symlinks $len"
68 du -a $symlinks > out || fail=1
70 # Require that at least one of these symlinks has a non-zero size.
71 grep '^[1-9]' out > /dev/null || fail=1
73 (exit $fail); exit $fail