common: kill _supported_os
[xfstests-dev.git] / tests / generic / 365
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 365
6 #
7 # RichACL chmod test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26
27 # remove previous $seqres.full before test
28 rm -f $seqres.full
29
30 # real QA test starts here
31
32 _supported_fs generic
33
34 _require_scratch
35 _require_scratch_richacl
36 _require_richacl_prog
37 _require_runas
38
39 _scratch_mkfs_richacl >> $seqres.full
40 _scratch_mount
41
42 cd $SCRATCH_MNT
43
44 r()
45 {
46         echo "--- runas -u 99 -g 99 $*"
47         _runas -u 99 -g 99 -- "$@"
48 }
49
50 s()
51 {
52         echo "--- runas -u 99 -g 99 setrichacl $*"
53         _runas -u 99 -g 99 -- $SETRICHACL_PROG "$@"
54 }
55
56 # Create file as root
57 touch a
58
59 # We cannot set the acl as another user
60 s --set 'u:99:rwc::allow' a
61
62 # We cannot chmod as another user
63 r chmod 666 a
64
65 # Give user 99 the write_acl permission
66 $SETRICHACL_PROG --set 'u:99:rwpC::allow' a
67
68 # Now user 99 can setrichacl and chmod ...
69 s --set 'u:99:rwpC::allow' a
70 r chmod 666 a
71
72 # ... but chmod disables the write_acl permission
73 s --set 'u:99:rwpC::allow' a
74
75 # success, all done
76 status=0
77 exit