]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: filter selinux output in _acl_ls etc
authorEric Sandeen <sandeen@sandeen.net>
Wed, 3 Feb 2010 14:35:24 +0000 (08:35 -0600)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 3 Feb 2010 14:35:24 +0000 (08:35 -0600)
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@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
105
common.attr
common.rc

diff --git a/105 b/105
index e3163fd9300fec7c685bae7eae0874e1a21645ff..9544c66379fa623f425f29ba454c27a609cf22eb 100755 (executable)
--- 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
index a6b9b3b59e733dd196141c8cd6f035693560243b..d12cc02bf4a7f97e6b8fcd7c0dd04a75e0a86a14 100644 (file)
@@ -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
 } 
 
 #
index 168551431f6e8274d476c64a1d4cb8070ed7edc0..67128381ec6ed1751fe55a5925eff0f17f6148db 100644 (file)
--- 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/\(^[-rwxdlbcpsStT]*\)\. /\1 /"
+}
+
 _mount_opts()
 {
     case $FSTYP in