From fc97a6df9bd039547e7b2d24a08fcbfe751eadbd Mon Sep 17 00:00:00 2001
From: bobijam <bobijam>
Date: Thu, 9 Aug 2007 03:34:20 +0000
Subject: [PATCH] Branch HEAD b=13177 i=green, wangdi

Description: sanity_quota fail test_1
Details    : There are multiple occurences of $TSTUSR in SLES's /etc/group
             file, which makes TSTID[2] inunique.
---
 lustre/ChangeLog             |  7 +++++++
 lustre/tests/sanity-quota.sh | 12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 1ab0e95e5f..fb8729a0ba 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -27,6 +27,13 @@ Description: warnings with build patchless client with vanila 2.6.19 and up
 Details    : change old ctl_table style and replace ctl_table/ctl_table_header
 	     with cfs_sysctl_table_t/cfs_sysctl_table_header_t
 
+Severity   : normal
+Bugzilla   : 13177
+Frequency  : Only for SLES
+Description: sanity_quota fail test_1
+Details    : There are multiple occurences of $TSTUSR in SLES's /etc/group
+             file, which makes TSTID[2] inunique.
+
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh
index 0379429871..0bde19a5a3 100644
--- a/lustre/tests/sanity-quota.sh
+++ b/lustre/tests/sanity-quota.sh
@@ -280,27 +280,27 @@ post_test() {
 
 setup() {
 	# create local test group
-	GRP="`cat /etc/group | grep "$TSTUSR" | awk -F: '{print $1}'`"
+	GRP="`cat /etc/group | grep "^${TSTUSR}:" | awk -F: '{print $1}'`"
 	if [ -z "$GRP" ]; then
 		groupadd -g $TSTID "$TSTUSR"
 	fi
-	TSTID="`cat /etc/group | grep "$TSTUSR" | awk -F: '{print $3}'`"
+	TSTID="`cat /etc/group | grep "^${TSTUSR}:" | awk -F: '{print $3}'`"
 
-        GRP2="`cat /etc/group | grep "$TSTUSR2" | awk -F: '{print $1}'`"
+        GRP2="`cat /etc/group | grep "^${TSTUSR2}:" | awk -F: '{print $1}'`"
         if [ -z "$GRP2" ]; then
                 groupadd -g $TSTID2 "$TSTUSR2"
         fi
-        TSTID2="`cat /etc/group | grep "$TSTUSR2" | awk -F: '{print $3}'`"
+        TSTID2="`cat /etc/group | grep "^${TSTUSR2}:" | awk -F: '{print $3}'`"
 
 	# create test user
-	USR="`cat /etc/passwd | grep "$TSTUSR" | awk -F: '{print $1}'`"
+	USR="`cat /etc/passwd | grep "^${TSTUSR}:" | awk -F: '{print $1}'`"
 	if [ -z "$USR" ]; then
 		useradd -u $TSTID -g $TSTID -d /tmp "$TSTUSR"
 	fi
 	
 	RUNAS="runas -u $TSTID"
 
-	USR2="`cat /etc/passwd | grep "$TSTUSR2" | awk -F: '{print $1}'`"
+	USR2="`cat /etc/passwd | grep "^${TSTUSR2}:" | awk -F: '{print $1}'`"
         if [ -z "$USR2" ]; then
                 useradd -u $TSTID2 -g $TSTID2 -d /tmp "$TSTUSR2"
         fi
-- 
GitLab