xfstests: cleanup duplicates in all tests
[xfstests-dev.git] / tests / generic / 237
1 #! /bin/bash
2 # FS QA Test No. 237
3 #
4 # Check user B can setfacl a file which belongs to user A
5 # See also http://marc.info/?l=linux-btrfs&m=127434445620298&w=2
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2010 FUJITSU LIMITED. All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 #-----------------------------------------------------------------------
24 #
25
26 seq=`basename $0`
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 runas=$here/src/runas
33 status=1        # FAILure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
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         [ -n "$testdir" ] && rm -rf $testdir/$seq.dir1
46         _cleanup_testdir
47 }
48
49 # real QA test starts here
50 _supported_fs generic
51 # only Linux supports fallocate
52 _supported_os Linux
53
54 [ -x $runas ] || _notrun "$runas executable not found"
55
56 rm -f $seqres.full
57
58 _setup_testdir
59
60 _need_to_be_root
61 _acl_setup_ids
62 _require_acls
63
64 # get dir
65 cd $testdir
66 rm -rf $seq.dir1
67 mkdir $seq.dir1
68 cd $seq.dir1
69
70 touch file1
71 chown $acl1.$acl1 file1
72
73 echo "Expect to FAIL"
74 $runas -u $acl2 -g $acl2 -- `which setfacl` -m u::rwx file1 2>&1 | sed 's/^setfacl: \/.*file1: Operation not permitted$/setfacl: file1: Operation not permitted/'
75
76 echo "Test over."
77 # success, all done
78 status=0
79 exit