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
34 cp /dev/null $seqres.full
35 chmod ugo+rwx $seqres.full
39 _require_xfs_quota_foreign
47 s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
48 s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
49 s,$SCRATCH_MNT,<MOUNT>,;
55 _scratch_mkfs >/dev/null 2>&1
59 touch $SCRATCH_MNT/testfile
60 if $here/src/feature -c $SCRATCH_MNT/testfile; then
63 _notrun "Installed fileutils doesn't support 32 bit uids/gids"
66 chown 12345 $SCRATCH_MNT/testfile
67 chgrp 54321 $SCRATCH_MNT/testfile
68 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
70 chown 34567 $SCRATCH_MNT/testfile
71 chgrp 76543 $SCRATCH_MNT/testfile
72 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
74 chown 56789 $SCRATCH_MNT/testfile
75 chgrp 98765 $SCRATCH_MNT/testfile
76 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
78 # finally give back to original owners
79 chown 12345 $SCRATCH_MNT/testfile
80 chgrp 54321 $SCRATCH_MNT/testfile
81 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
84 _scratch_unmount 2>/dev/null
87 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
89 _qmount_option "usrquota,grpquota"
91 if $here/src/feature -G $SCRATCH_DEV ; then
94 _notrun "No quota support at mount time"
96 _scratch_unmount 2>/dev/null
98 _qmount_option "rw" # no quota options
99 echo "*** Default mount options"
102 _qmount_option "usrquota"
103 echo "*** User quota mount option"
106 _qmount_option "grpquota"
107 echo "*** Group quota mount option"
110 _qmount_option "usrquota,grpquota"
111 echo "*** User and Group quota mount options"