generic/077: fall back to /usr if /lib/modules doesn't exist
[xfstests-dev.git] / tests / generic / 105
1 #! /bin/bash
2 # FS QA Test No. 105
3 #
4 # Test fix of bug:
5 #   930290 - xfs directory with no exec perm in ACL denies access
6 #            and breaks CAPP evaluation
7 #   which pulls out an earlier mod
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #
25 #-----------------------------------------------------------------------
26 #
27
28 seq=`basename $0`
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
36
37 _cleanup()
38 {
39     cd /
40 }
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45 . ./common/attr
46
47 # Modify as appropriate.
48 _supported_fs generic
49 _supported_os IRIX Linux
50
51 # real QA test starts here
52
53 rm -f $seqres.full
54
55 _require_scratch
56 _require_acls
57
58 _acl_setup_ids
59
60 umount $SCRATCH_DEV >/dev/null 2>&1
61 echo "*** MKFS ***"                         >>$seqres.full
62 echo ""                                     >>$seqres.full
63 _scratch_mkfs                               >>$seqres.full 2>&1 \
64         || _fail "mkfs failed"
65 _scratch_mount                              >>$seqres.full 2>&1 \
66         || _fail "mount failed"
67
68 cd $SCRATCH_MNT
69
70 # create a dir with out execute perms
71 mkdir -m 600 subdir
72
73 # make it owned by $acl1
74 chown $acl1 subdir
75
76 # put a file in the directory
77 echo data > subdir/file
78 _ls_l subdir/file | awk '{ print $1, $3 }'
79
80 # add an ACL with a user ACE which has no exec permission 
81 if [ "$HOSTOS" == "Linux" ]; then
82     setfacl -m u:$acl1:r subdir
83 elif [ "$HOSTOS" == "IRIX" ]; then
84     chacl u:$acl:r--,g::---,o::--- subdir
85 else
86     echo "Unknown OS!"
87     exit 1
88 fi
89
90 # With the bug this gives: `ls: subdir/file: Permission denied'
91 # because one needs at least an exec perm somewhere in acl
92 # However, this should not hold true for directories.
93 _ls_l subdir/file | awk '{ print $1, $3 }'
94
95 # With the bug this gives: `subdir/file2: Permission denied'.
96 echo data2 > subdir/file2
97
98 # success, all done
99 status=0
100 exit