xfs: test repairing false positive reserved attr name use
[xfstests-dev.git] / tests / xfs / 053
1 #! /bin/bash
2 # FS QA Test 053
3 #
4 # Ensure that xfs_repair can properly spot SGI_ACL_FILE
5 # and SGI_ACL_DEFAULT in the root attr namespace.
6 #
7 # Due to bugs here and there, we sometimes matched on partial
8 # strings with those names, and threw off xfs_repair.
9 #
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2015 Red Hat, Inc.  All Rights Reserved.
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
16 #
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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
36 # get standard environment, filters and checks
37 . ./common/rc
38 . ./common/filter
39 . ./common/attr
40
41 _cleanup()
42 {
43         cd /
44         rm -f $tmp.*
45 }
46 trap "_cleanup; exit \$status" 0 1 2 3 15
47
48 # real QA test starts here
49
50 _supported_fs xfs
51 _supported_os IRIX Linux
52 _require_scratch
53 _require_attrs
54
55 _scratch_mkfs >/dev/null 2>&1
56 _scratch_mount
57
58 # Create root attr names which are substrings or superstrings
59 # of the reserved ACL names, and make sure xfs_repair copes.
60
61 # Due to various bugs, either the compared length was shorter
62 # than the reserved name (7 chars), so substrings matched, and/or only
63 # the reserved name length was compared, so superstrings matched.
64
65 rm -f $SCRATCH_MNT/$seq.*
66
67 # actual reserved names:
68 #           SGI_ACL_FILE        SGI_ACL_DEFAULT
69 for NAME in SGI_ACL \
70             SGI_ACL_F           SGI_ACL_D \
71             SGI_ACL_FILE_FOO    SGI_ACL_DEFAULT_FOO; do
72         touch $SCRATCH_MNT/${seq}.${NAME}
73         $ATTR_PROG -R -s $NAME -V "Wow, such $NAME" $SCRATCH_MNT/$seq.$NAME \
74                 | _filter_scratch
75 done
76
77 # Older repair failed because it sees the above names as matching
78 # SGI_ACL_FILE / SGI_ACL_DEFAULT but w/o valid acls on them
79
80 # The test harness will catch this (false positive) corruption
81
82 # success, all done
83 status=0
84 exit