2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # Check behavior of chown with both user and group quota enabled,
8 # and changing both user and group together via chown(2).
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
18 # get standard environment, filters and checks
25 _scratch_unmount 2>/dev/null
28 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # real QA test starts here
33 cp /dev/null $seqres.full
34 chmod ugo+rwx $seqres.full
38 _require_xfs_quota_foreign
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>,;
54 _scratch_mkfs >/dev/null 2>&1
58 touch $SCRATCH_MNT/testfile
59 if $here/src/feature -c $SCRATCH_MNT/testfile; then
62 _notrun "Installed fileutils doesn't support 32 bit uids/gids"
65 chown 12345 $SCRATCH_MNT/testfile
66 chgrp 54321 $SCRATCH_MNT/testfile
67 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
69 chown 34567 $SCRATCH_MNT/testfile
70 chgrp 76543 $SCRATCH_MNT/testfile
71 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
73 chown 56789 $SCRATCH_MNT/testfile
74 chgrp 98765 $SCRATCH_MNT/testfile
75 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
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
83 _scratch_unmount 2>/dev/null
86 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
88 _qmount_option "usrquota,grpquota"
90 if $here/src/feature -G $SCRATCH_DEV ; then
93 _notrun "No quota support at mount time"
95 _scratch_unmount 2>/dev/null
97 _qmount_option "rw" # no quota options
98 echo "*** Default mount options"
101 _qmount_option "usrquota"
102 echo "*** User quota mount option"
105 _qmount_option "grpquota"
106 echo "*** Group quota mount option"
109 _qmount_option "usrquota,grpquota"
110 echo "*** User and Group quota mount options"