xfstests: move GPL boilerplates to fix lsqa.pl
[xfstests-dev.git] / 053
1 #! /bin/sh
2 # FS QA Test No. 053
3 #
4 # xfs_repair breaks acls
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24 # creator
25 owner=ajag@sgi.com
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
34
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
38 . ./common.attr
39
40 # real QA test starts here
41 _supported_fs xfs
42 _supported_os Linux
43
44 [ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
45
46 _require_scratch
47 _acl_setup_ids
48 _do_die_on_error=y
49 test=$SCRATCH_MNT/test
50
51 # make filesystem on scratch using the defaults
52 _do 'make filesystem on $SCRATCH_DEV' '_scratch_mkfs_xfs'
53 _do 'mount filesytem' '_scratch_mount'
54
55 # create test files and set acls
56 acls="
57 u::r--,g::rwx,o::rw-
58 u::r-x,g::---,o::---
59 u::---,g::r-x,o::---
60 u::---,g::---,o::r-x
61 u::---,g::r-x,o::rwx
62 u::---,g::---,o::---,u:$acl2:r-x,m::rwx
63 u::rwx,g::r-x,o::r--
64 u::---,g::---,o::---,g:$acl2:r-x,m::-w-"
65
66 i=0
67 for acl in $acls
68 do
69   _do "touch $test.$i"
70   _do "chacl $acl $test.$i"
71   let i=$i+1
72 done
73
74 list_acls()
75 {
76   i=0
77   for acl in $acls
78   do
79     chacl -l $test.$i | _acl_filter_id | sed -e "s!$SCRATCH_MNT!\$SCRATCH_MNT!"
80     let i=$i+1
81   done
82 }
83
84 echo "acls before repair:"
85 list_acls
86 _do 'unmount $SCRATCH_DEV' 'umount $SCRATCH_DEV'
87 _do 'repair filesystem' '_scratch_xfs_repair'
88 _do 'mount filesytem' '_scratch_mount'
89 echo "acls after repair: "
90 list_acls
91
92 # success, all done
93 status=0; exit