From 3f6294a482651802fb97175b6e8c6568a371352a Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Wed, 8 May 2019 00:55:04 +0900 Subject: [PATCH] LU-12267 tests: update filter in acl for SElinux case With SElinux enforced on client, sanity.sh test_103a fails because the "ls -l" command produces an extra '.' at the end to indicate extra security attributes are set. So update filter by removing this trailing '.' in the output. Test-Parameters: trivial testlist=sanity envdefinitions=ONLY=103a Test-Parameters: clientselinux testlist=sanity envdefinitions=ONLY=103a Signed-off-by: Sebastien Buisson Change-Id: Ie684a3fe02f0f2821c8059855165a0f9dd585b72 Reviewed-on: https://review.whamcloud.com/34818 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: James Nunez Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- lustre/tests/acl/974_remote.test | 7 ++++--- lustre/tests/acl/permissions_xattr.test | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lustre/tests/acl/974_remote.test b/lustre/tests/acl/974_remote.test index cea27c6..345d1cb 100644 --- a/lustre/tests/acl/974_remote.test +++ b/lustre/tests/acl/974_remote.test @@ -1,20 +1,21 @@ LU-974 ignore umask when default acl with mask is set +# Need to remove trailing '.' when SELinux is enabled $ umask 022 $ lfs mkdir -i 1 974 $ touch 974/f1 - $ ls -dl 974/f1 | awk '{ print $1 }' + $ ls -dl 974/f1 | awk '{ sub(/\\.$/, "", $1); print $1 }' > -rw-r--r-- $ setfacl -R -d -m mask:007 974 $ touch 974/f2 - $ ls -dl 974/f2 | awk '{ print $1 }' + $ ls -dl 974/f2 | awk '{ sub(/\\.$/, "", $1); print $1 }' > -rw-rw-r--+ $ umask 077 $ touch f3 - $ ls -dl f3 | awk '{ print $1 }' + $ ls -dl f3 | awk '{ sub(/\\.$/, "", $1); print $1 }' > -rw------- $ rm -rf 974 diff --git a/lustre/tests/acl/permissions_xattr.test b/lustre/tests/acl/permissions_xattr.test index d4ca17b..8682fc9 100644 --- a/lustre/tests/acl/permissions_xattr.test +++ b/lustre/tests/acl/permissions_xattr.test @@ -14,13 +14,14 @@ Cry immediately if we are not running as root. First, set up a temporary directory and create a regular file with defined permissions. +# Need to remove trailing '.' when SELinux is enabled $ mkdir d $ cd d $ umask 027 $ touch f $ chown nobody:nobody f - $ ls -l f | awk -- '{ print $1, $3, $4 }' + $ ls -l f | awk -- '{ sub(/\\.$/, "", $1); print $1, $3, $4 }' > -rw-r----- nobody nobody $ su nobody $ echo nobody > f @@ -60,10 +61,11 @@ to set extended attributes in user.* namespace for files. Test if symlinks are properly followed. +# Need to remove trailing '.' when SELinux is enabled $ su $ ln -s f l - $ ls -l l | awk -- '{ print $1, $3, $4 }' + $ ls -l l | awk -- '{ sub(/\\.$/, "", $1); print $1, $3, $4 }' > lrwxrwxrwx root root $ su bin $ getfattr -d l @@ -74,12 +76,13 @@ Test if symlinks are properly followed. Test the sticky directories. Only the owner and privileged user can write attributes. +# Need to remove trailing '.' when SELinux is enabled $ su $ mkdir t $ chown nobody:nobody t $ chmod 1750 t - $ ls -dl t | awk -- '{ print $1, $3, $4 }' + $ ls -dl t | awk -- '{ sub(/\\.$/, "", $1); print $1, $3, $4 }' > drwxr-x--T nobody nobody $ su nobody $ setfacl -m g:bin:rwx t @@ -97,12 +100,13 @@ write attributes. Verify that the additional ACL entry grants user bin permission to set extended attributes in user.* namespace for directories. +# Need to remove trailing '.' when SELinux is enabled $ su $ mkdir d $ chown nobody:nobody d $ chmod 750 d - $ ls -dl d | awk -- '{ print $1, $3, $4 }' + $ ls -dl d | awk -- '{ sub(/\\.$/, "", $1); print $1, $3, $4 }' > drwxr-x--- nobody nobody $ su nobody $ setfacl -m g:bin:rwx d -- 1.8.3.1