2 # Use du to exercise a corner of fts's FTS_LOGICAL code.
3 # Show that du fails with ELOOP (Too many levels of symbolic links)
4 # when it encounters that condition.
6 if test "$VERBOSE" = yes; then
11 . $srcdir/../lang-default
14 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
15 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
16 trap '(exit $?); exit $?' 1 2 13 15
19 mkdir -p $tmp || framework_failure=1
20 cd $tmp || framework_failure=1
22 # Create lots of directories, each containing a single symlink
23 # pointing at the next directory in the list.
25 # This number should be larger than the number of symlinks allowed in
26 # file name resolution, but not too large as a number of entries
27 # in a single directory.
31 mkdir $dir_list || framework_failure=1
32 for i in $dir_list; do
34 ln -s ../$ip1 $i/s || framework_failure=1
37 if test $framework_failure = 1; then
38 echo "$0: failure in testing framework" 1>&2
44 # With coreutils-5.93 there was no failure.
45 # With coreutils-5.94 we get a diagnostic like this:
46 # du: cannot access `1/s/s/s/.../s': Too many levels of symbolic links
47 du -L 1 > /dev/null 2> out1 && fail=1
48 sed "s,1/s/s/s/[/s]*','," out1 > out || fail=1
49 cat <<\EOF > exp || fail=1
50 du: cannot access `': Too many levels of symbolic links
54 test $fail = 1 && diff out exp 2> /dev/null
56 (exit $fail); exit $fail