generic/611: Use _getfattr instead of GETFATTR_PROG
[xfstests-dev.git] / tests / generic / 005
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 005
6 #
7 # Test symlinks & ELOOP
8 #
9 #
10 # Note: On Linux, ELOOP limit used to be 32 but changed to 8, and lately
11 # its become 5.  Who knows what it might be next.
12
13 # What we are looking for here is: no panic due to blowing the stack;
14 # and that the ELOOP error code is returned at some point (the actual
15 # limit point is unimportant, just checking that we do hit it).
16
17
18 seq=`basename $0`
19 seqres=$RESULT_DIR/$seq
20 echo "QA output created by $seq"
21
22 here=`pwd`
23 tmp=/tmp/$$
24 status=0        # success is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 _cleanup()
28 {
29     cd $TEST_DIR
30     rm -f symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9} symlink_self empty_file
31     cd /
32 }
33
34 _touch()
35 {
36     touch $@ 2>&1 | grep -q 'Too many levels of symbolic links'
37     if [ $? -eq 0 ]; then
38         echo "ELOOP returned.  Good."
39     else
40         echo "No ELOOP?  Unexpected!"
41     fi
42 }
43
44 # get standard environment, filters and checks
45 . ./common/rc
46 . ./common/filter
47
48 # real QA test starts here
49 _supported_fs generic
50 _require_test
51 _require_symlinks
52
53
54 cd $TEST_DIR
55
56 o=empty_file
57 touch $o
58 for f in symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
59 do
60     ln -s $o $f
61     o=$f
62 done
63
64 ln -s symlink_self symlink_self
65
66 echo "*** touch deep symlinks"
67 echo ""
68 _touch symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
69 echo ""
70 echo "*** touch recusive symlinks"
71 echo ""
72 _touch symlink_self
73
74 exit