fix group listing regexp
[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 #
10 # creator
11 owner=ajag@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20
21 # get standard environment, filters and checks
22 . ./common.rc
23 . ./common.filter
24 . ./common.attr
25
26 # real QA test starts here
27 _supported_fs xfs
28 _supported_os Linux
29
30 [ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
31
32 _require_scratch
33 _acl_setup_ids
34 _do_die_on_error=y
35 test=$SCRATCH_MNT/test
36
37 # make filesystem on scratch using the defaults
38 _do 'make filesystem on $SCRATCH_DEV' '_scratch_mkfs_xfs'
39 _do 'mount filesytem' '_scratch_mount'
40
41 # create test files and set acls
42 acls="
43 u::r--,g::rwx,o::rw-
44 u::r-x,g::---,o::---
45 u::---,g::r-x,o::---
46 u::---,g::---,o::r-x
47 u::---,g::r-x,o::rwx
48 u::---,g::---,o::---,u:$acl2:r-x,m::rwx
49 u::rwx,g::r-x,o::r--
50 u::---,g::---,o::---,g:$acl2:r-x,m::-w-"
51
52 i=0
53 for acl in $acls
54 do
55   _do "touch $test.$i"
56   _do "chacl $acl $test.$i"
57   i=`expr $i + 1`
58 done
59
60 list_acls()
61 {
62   i=0
63   for acl in $acls
64   do
65     chacl -l $test.$i | _acl_filter_id | sed -e "s!$SCRATCH_MNT!\$SCRATCH_MNT!"
66     i=`expr $i + 1`
67   done
68 }
69
70 echo "acls before repair:"
71 list_acls
72 _do 'unmount $SCRATCH_DEV' 'umount $SCRATCH_DEV'
73 _do 'repair filesystem' '_scratch_xfs_repair'
74 _do 'mount filesytem' '_scratch_mount'
75 echo "acls after repair: "
76 list_acls
77
78 # success, all done
79 status=0; exit