generic/554: hide permision warning on exfat
[xfstests-dev.git] / tests / generic / 379
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 379
6 #
7 # Check behavior of chown with both user and group quota enabled,
8 # and changing both user and group together via chown(2).
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=1        # failure is the default!
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21 . ./common/quota
22
23 _cleanup()
24 {
25         _scratch_unmount 2>/dev/null
26         rm -f $tmp.*
27 }
28 trap "_cleanup; exit \$status" 0 1 2 3 15
29
30 # real QA test starts here
31 _supported_fs generic
32
33 cp /dev/null $seqres.full
34 chmod ugo+rwx $seqres.full
35
36 _require_scratch
37 _require_quota
38 _require_xfs_quota_foreign
39
40 _filter_stat()
41 {
42     sed "
43         /^Access:/d;
44         /^Modify:/d;
45         /^Change:/d;
46         s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
47         s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
48         s,$SCRATCH_MNT,<MOUNT>,;
49     " | tr -s ' '
50 }
51
52 _exercise()
53 {
54         _scratch_mkfs >/dev/null 2>&1
55         _qmount
56
57         umask 022
58         touch $SCRATCH_MNT/testfile
59         if $here/src/feature -c $SCRATCH_MNT/testfile; then
60                 :
61         else
62                 _notrun "Installed fileutils doesn't support 32 bit uids/gids"
63         fi
64
65         chown 12345 $SCRATCH_MNT/testfile
66         chgrp 54321 $SCRATCH_MNT/testfile
67         $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
68
69         chown 34567 $SCRATCH_MNT/testfile
70         chgrp 76543 $SCRATCH_MNT/testfile
71         $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
72
73         chown 56789 $SCRATCH_MNT/testfile
74         chgrp 98765 $SCRATCH_MNT/testfile
75         $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
76
77         # finally give back to original owners
78         chown 12345 $SCRATCH_MNT/testfile
79         chgrp 54321 $SCRATCH_MNT/testfile
80         $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
81
82         echo
83         _scratch_unmount 2>/dev/null
84 }
85
86 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
87
88 _qmount_option "usrquota,grpquota"
89 _qmount
90 if $here/src/feature -G $SCRATCH_DEV ; then
91         :
92 else
93         _notrun "No quota support at mount time"
94 fi
95 _scratch_unmount 2>/dev/null
96
97 _qmount_option "rw" # no quota options
98 echo "*** Default mount options"
99 _exercise
100
101 _qmount_option "usrquota"
102 echo "*** User quota mount option"
103 _exercise
104
105 _qmount_option "grpquota"
106 echo "*** Group quota mount option"
107 _exercise
108
109 _qmount_option "usrquota,grpquota"
110 echo "*** User and Group quota mount options"
111 _exercise
112
113 # success, all done
114 status=0
115 exit