generic/611: Use _getfattr instead of GETFATTR_PROG
[xfstests-dev.git] / tests / generic / 123
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 123
6 #
7 # Make sure user cannot overwrite, append, delete or move a file created by 
8 # root. Modified CXFSQA test 940960 and 940558.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=0        # success is the default!
17
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22     cd $TEST_DIR
23     rm -rf $my_test_subdir
24     cd /
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs generic
33
34 _require_test
35 _require_user
36
37 my_test_subdir=$TEST_DIR/123subdir
38
39 # create subdir with required permissions
40 mkdir -m 755 $my_test_subdir
41
42 echo foo > $my_test_subdir/data_coherency.txt
43 # check basic appending to a file
44 echo bar >> $my_test_subdir/data_coherency.txt
45
46 # try append
47 _user_do "echo goo >> $my_test_subdir/data_coherency.txt" 
48
49 # try overwrite 
50 _user_do "echo goo > $my_test_subdir/data_coherency.txt" 
51
52 # try delete
53 _user_do "rm $my_test_subdir/data_coherency.txt" 
54
55 # try move
56 _user_do "mv $my_test_subdir/data_coherency.txt $my_test_subdir/data_coherency2.txt" 
57
58 cat $my_test_subdir/data_coherency.txt
59
60 exit