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 _begin_fstest quota auto quick
13 # Import common functions.
17 # Override the default cleanup function.
20 _scratch_unmount 2>/dev/null
24 # real QA test starts here
27 cp /dev/null $seqres.full
28 chmod ugo+rwx $seqres.full
32 _require_xfs_quota_foreign
40 s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
41 s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
42 s,$SCRATCH_MNT,<MOUNT>,;
48 _scratch_mkfs >/dev/null 2>&1
52 touch $SCRATCH_MNT/testfile
53 if $here/src/feature -c $SCRATCH_MNT/testfile; then
56 _notrun "Installed fileutils doesn't support 32 bit uids/gids"
59 chown 12345 $SCRATCH_MNT/testfile
60 chgrp 54321 $SCRATCH_MNT/testfile
61 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
63 chown 34567 $SCRATCH_MNT/testfile
64 chgrp 76543 $SCRATCH_MNT/testfile
65 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
67 chown 56789 $SCRATCH_MNT/testfile
68 chgrp 98765 $SCRATCH_MNT/testfile
69 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
71 # finally give back to original owners
72 chown 12345 $SCRATCH_MNT/testfile
73 chgrp 54321 $SCRATCH_MNT/testfile
74 $here/src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
77 _scratch_unmount 2>/dev/null
80 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
82 _qmount_option "usrquota,grpquota"
84 if $here/src/feature -G $SCRATCH_DEV ; then
87 _notrun "No quota support at mount time"
89 _scratch_unmount 2>/dev/null
91 _qmount_option "rw" # no quota options
92 echo "*** Default mount options"
95 _qmount_option "usrquota"
96 echo "*** User quota mount option"
99 _qmount_option "grpquota"
100 echo "*** Group quota mount option"
103 _qmount_option "usrquota,grpquota"
104 echo "*** User and Group quota mount options"