Whamcloud - gitweb
LU-10327 test: use nogroup instead of nobody 72/30772/3
authorMinh Diep <minh.diep@intel.com>
Fri, 15 Dec 2017 20:48:58 +0000 (12:48 -0800)
committerJohn L. Hammond <john.hammond@intel.com>
Fri, 2 Feb 2018 17:18:40 +0000 (17:18 +0000)
In Ubuntu, there isn't any nobody group

Lustre-change: https://review.whamcloud.com/#/c/30559/
Lustre-commit: 6229a5ff318471fda18daceec79143007c4b204f

Change-Id: I2d4607b3d1384d2d619dd9640363533f92397356
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/30772
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/tests/lustre-rsync-test.sh
lustre/tests/sanity-hsm.sh

index b3fe03d..a67447e 100644 (file)
@@ -38,6 +38,13 @@ check_and_setup_lustre
 DIR=${DIR:-$MOUNT}
 assert_DIR
 
+if getent group nobody; then
+       GROUP=nobody
+elif getent group nogroup; then
+       GROUP=nogroup
+else
+       error "No generic nobody group"
+fi
 
 build_test_filter
 
@@ -196,7 +203,7 @@ test_1() {
 
     # Set attributes
     chmod 000 $DIR/$tdir/d2/file3
-    chown nobody:nobody $DIR/$tdir/d2/file3
+    chown nobody:$GROUP $DIR/$tdir/d2/file3
 
     # Set xattrs
     if [[ "$xattr" != "no" ]]; then
index c1ac06f..7941b8f 100755 (executable)
@@ -43,6 +43,13 @@ if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
        skip_env "\$RUNAS_ID set to 0, but \$UID is also 0!" && exit
 fi
 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
+if getent group nobody; then
+       GROUP=nobody
+elif getent group nogroup; then
+       GROUP=nogroup
+else
+       error "No generic nobody group"
+fi
 
 build_test_filter
 
@@ -2174,8 +2181,8 @@ test_24c() {
        # User.
        rm -f $file
        make_small $file
-       chown $RUNAS_ID:nobody $file ||
-               error "cannot chown '$file' to '$RUNAS_ID:nobody'"
+       chown $RUNAS_ID:$GROUP $file ||
+               error "cannot chown '$file' to '$RUNAS_ID:$GROUP'"
 
        $RUNAS $LFS hsm_$action $file &&
                error "$action by user should fail"
@@ -2200,8 +2207,8 @@ test_24c() {
        # Other.
        rm -f $file
        make_small $file
-       chown nobody:nobody $file ||
-               error "cannot chown '$file' to 'nobody:nobody'"
+       chown nobody:$GROUP $file ||
+               error "cannot chown '$file' to 'nobody:$GROUP'"
 
        $RUNAS $LFS hsm_$action $file &&
                error "$action by other should fail"