[PATCH] generic/317: use id to get user id

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Greping username "fsgqa" in passwd file to get user id doesn't
always work, because the given username could match multiple
entries, e.g. when we have user "123456-fsgqa" (used by other tests)
in passwd file.

Fix it by using "id -u $qa_user" to get the user id directly.

Signed-off-by: Eryu Guan <eguan@xxxxxxxxxx>
---
 tests/generic/317 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/generic/317 b/tests/generic/317
index 9d9499b..7e40b1f 100755
--- a/tests/generic/317
+++ b/tests/generic/317
@@ -61,7 +61,7 @@ _require_scratch
 _require_user
 _require_ugid_map
 _require_userns
-qa_user_id=`grep $qa_user /etc/passwd |awk -F: '{print $3}'`
+qa_user_id=`id -u $qa_user`
 
 _filter_output()
 {
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux