All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH V2] xfstests: filter selinux output in _acl_ls etc
Date: Thu, 28 Jan 2010 22:39:51 -0600	[thread overview]
Message-ID: <4B626697.3080006@sandeen.net> (raw)
In-Reply-To: <4B61C1BC.4050800@sandeen.net>

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>
---

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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2010-01-29  4:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28 16:56 [PATCH] xfstests: filter selinux output in _acl_ls Eric Sandeen
2010-01-28 23:34 ` Eric Sandeen
2010-01-29  4:39 ` Eric Sandeen [this message]
2010-02-02 23:06   ` [PATCH V3] xfstests: filter selinux output in _acl_ls etc Eric Sandeen
2010-02-03 10:56     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B626697.3080006@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.