xfs
[Top] [All Lists]

[PATCH V2] xfstests: filter selinux output in _acl_ls etc

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH V2] xfstests: filter selinux output in _acl_ls etc
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 28 Jan 2010 22:39:51 -0600
In-reply-to: <4B61C1BC.4050800@xxxxxxxxxxx>
References: <4B61C1BC.4050800@xxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
When selinux is on, ls -l gives us a "." to indicate selinux
attrs, which breaks some tests:

 === Test minimal ACE ===
 Setup file
--rwxrw-r-- id1 id2 file1
+-rwxrw-r--. id1 id2 file1

so make an _ls_l helper to filter that out.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
---

diff --git a/105 b/105
index e3163fd..9544c66 100755
--- a/105
+++ b/105
@@ -76,7 +76,7 @@ chown $acl1 subdir
 
 # put a file in the directory
 echo data > subdir/file
-ls -l subdir/file | awk '{ print $1, $3 }'
+_ls_l subdir/file | awk '{ print $1, $3 }'
 
 # add an ACL with a user ACE which has no exec permission 
 if [ "$HOSTOS" == "Linux" ]; then
@@ -91,7 +91,7 @@ fi
 # With the bug this gives: `ls: subdir/file: Permission denied'
 # because one needs at least an exec perm somewhere in acl
 # However, this should not hold true for directories.
-ls -l subdir/file | awk '{ print $1, $3 }'
+_ls_l subdir/file | awk '{ print $1, $3 }'
 
 # With the bug this gives: `subdir/file2: Permission denied'.
 echo data2 > subdir/file2
diff --git a/common.attr b/common.attr
index a6b9b3b..d12cc02 100644
--- a/common.attr
+++ b/common.attr
@@ -58,7 +58,7 @@ _acl_filter_id()
 #
 _acl_ls()
 {
-    ls -ln $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
+    _ls_l -n $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
 } 
 
 #
diff --git a/common.rc b/common.rc
index cf2662a..237f3aa 100644
--- a/common.rc
+++ b/common.rc
@@ -37,6 +37,14 @@ dd()
    fi
 }
 
+# ls -l w/ selinux sometimes puts a dot at the end:
+# -rwxrw-r--. id1 id2 file1
+
+_ls_l()
+{
+       ls -l $* | sed "s/\(.*\)\. /\1 /"
+}
+
 _mount_opts()
 {
     case $FSTYP in

<Prev in Thread] Current Thread [Next in Thread>