274: Many fixups
[xfstests-dev.git] / 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 # creator
28 owner=fsgqa@snap.melbourne.sgi.com
29
30 seq=`basename $0`
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 _cleanup()
39 {
40     cd /
41 }
42
43 # get standard environment, filters and checks
44 . ./common.rc
45 . ./common.filter
46 . ./common.attr
47
48 # Modify as appropriate.
49 _supported_fs generic
50 _supported_os IRIX Linux
51
52 # real QA test starts here
53
54 rm -f $seq.full
55
56 _require_scratch
57 _require_acls
58
59 _acl_setup_ids
60
61 umount $SCRATCH_DEV >/dev/null 2>&1
62 echo "*** MKFS ***"                         >>$seq.full
63 echo ""                                     >>$seq.full
64 _scratch_mkfs                               >>$seq.full 2>&1 \
65         || _fail "mkfs failed"
66 _scratch_mount                              >>$seq.full 2>&1 \
67         || _fail "mount failed"
68
69 cd $SCRATCH_MNT
70
71 # create a dir with out execute perms
72 mkdir -m 600 subdir
73
74 # make it owned by $acl1
75 chown $acl1 subdir
76
77 # put a file in the directory
78 echo data > subdir/file
79 _ls_l subdir/file | awk '{ print $1, $3 }'
80
81 # add an ACL with a user ACE which has no exec permission 
82 if [ "$HOSTOS" == "Linux" ]; then
83     setfacl -m u:$acl1:r subdir
84 elif [ "$HOSTOS" == "IRIX" ]; then
85     chacl u:$acl:r--,g::---,o::--- subdir
86 else
87     echo "Unknown OS!"
88     exit 1
89 fi
90
91 # With the bug this gives: `ls: subdir/file: Permission denied'
92 # because one needs at least an exec perm somewhere in acl
93 # However, this should not hold true for directories.
94 _ls_l subdir/file | awk '{ print $1, $3 }'
95
96 # With the bug this gives: `subdir/file2: Permission denied'.
97 echo data2 > subdir/file2
98
99 # success, all done
100 status=0
101 exit