Skip to content

Commit 4545386

Browse files
Zorro Langdchinner
Zorro Lang
authored andcommitted
xfs: test user and group quota names beginning with digits
There's a known bug of xfsprogs, when a user or group name beinning with digits, xfs_quota can't create 'limit' for it. Signed-off-by: Zorro Lang <[email protected]> Reviewed-by: Eric Sandeen <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 3235a95 commit 4545386

File tree

5 files changed

+94
-2
lines changed

5 files changed

+94
-2
lines changed

Diff for: README

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Building Linux:
1212
- run make
1313
- run make install
1414
- create fsgqa test user ("sudo useradd fsgqa")
15+
- create 123456-fsgqa test user ("sudo useradd 123456-fsgqa")
1516

1617
Building IRIX:
1718
- cd into the xfstests directory

Diff for: common/rc

+8-2
Original file line numberDiff line numberDiff line change
@@ -1582,22 +1582,28 @@ _cat_group()
15821582
cat /etc/group
15831583
}
15841584

1585-
# check for the fsgqa user on the machine
1585+
# check for a user on the machine, fsgqa as default
15861586
#
15871587
_require_user()
15881588
{
15891589
qa_user=fsgqa
1590+
if [ -n "$1" ];then
1591+
qa_user=$1
1592+
fi
15901593
_cat_passwd | grep -q $qa_user
15911594
[ "$?" == "0" ] || _notrun "$qa_user user not defined."
15921595
echo /bin/true | su $qa_user
15931596
[ "$?" == "0" ] || _notrun "$qa_user cannot execute commands."
15941597
}
15951598

1596-
# check for the fsgqa group on the machine
1599+
# check for a group on the machine, fsgqa as default
15971600
#
15981601
_require_group()
15991602
{
16001603
qa_group=fsgqa
1604+
if [ -n "$1" ];then
1605+
qa_group=$1
1606+
fi
16011607
_cat_group | grep -q $qa_group
16021608
[ "$?" == "0" ] || _notrun "$qa_group user not defined."
16031609
}

Diff for: tests/xfs/138

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#! /bin/bash
2+
# FS QA Test 138
3+
#
4+
# Test xfs_quota when user or names beginning with digits.
5+
# For example, create a 'limit' for a user or group named
6+
# '12345678-abcd', then query this user and group.
7+
#
8+
#-----------------------------------------------------------------------
9+
# Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
10+
#
11+
# This program is free software; you can redistribute it and/or
12+
# modify it under the terms of the GNU General Public License as
13+
# published by the Free Software Foundation.
14+
#
15+
# This program is distributed in the hope that it would be useful,
16+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
# GNU General Public License for more details.
19+
#
20+
# You should have received a copy of the GNU General Public License
21+
# along with this program; if not, write the Free Software Foundation,
22+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23+
#-----------------------------------------------------------------------
24+
#
25+
26+
seq=`basename $0`
27+
seqres=$RESULT_DIR/$seq
28+
echo "QA output created by $seq"
29+
30+
here=`pwd`
31+
tmp=/tmp/$$
32+
status=1 # failure is the default!
33+
trap "_cleanup; exit \$status" 0 1 2 3 15
34+
35+
_cleanup()
36+
{
37+
cd /
38+
rm -f $tmp.*
39+
}
40+
41+
# get standard environment, filters and checks
42+
. ./common/rc
43+
. ./common/filter
44+
. ./common/quota
45+
46+
# remove previous $seqres.full before test
47+
rm -f $seqres.full
48+
49+
# real QA test starts here
50+
51+
# Modify as appropriate.
52+
_supported_fs xfs
53+
_supported_os Linux
54+
_require_scratch
55+
_require_quota
56+
57+
# need user and group named 123456-fsgqa
58+
_require_user 123456-fsgqa
59+
_require_group 123456-fsgqa
60+
61+
_scratch_mkfs_xfs >/dev/null 2>&1
62+
_qmount_option "uquota,gquota"
63+
_qmount
64+
65+
# user test
66+
xfs_quota -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT >>$seqres.full 2>&1
67+
[ $? -ne 0 ] && _fail "Create limit for user 123456-fsgqa Failed"
68+
xfs_quota -x -c "quota -u -v 123456-fsgqa" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
69+
[ $? -ne 0 ] && _fail "Query user 123456-fsgqa Failed"
70+
xfs_quota -x -c "report -u" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
71+
[ $? -ne 0 ] && _fail "Report user 123456-fsgqa Failed"
72+
73+
# group test
74+
xfs_quota -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT >>$seqres.full 2>&1
75+
[ $? -ne 0 ] && _fail "Create limit for group 123456-fsgqa Failed"
76+
xfs_quota -x -c "quota -g -v 123456-fsgqa" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
77+
[ $? -ne 0 ] && _fail "Query group 123456-fsgqa Failed"
78+
xfs_quota -x -c "report -u" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
79+
[ $? -ne 0 ] && _fail "Report group 123456-fsgqa Failed"
80+
81+
# success, all done
82+
status=0
83+
exit

Diff for: tests/xfs/138.out

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
QA output created by 138

Diff for: tests/xfs/group

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
135 auto logprint quick v2log
136136
136 attr2
137137
137 auto metadata v2log
138+
138 auto quick quota
138139
142 dmapi
139140
143 dmapi
140141
144 dmapi

0 commit comments

Comments
 (0)