public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: filter selinux output in _acl_ls
@ 2010-01-28 16:56 Eric Sandeen
  2010-01-28 23:34 ` Eric Sandeen
  2010-01-29  4:39 ` [PATCH V2] xfstests: filter selinux output in _acl_ls etc Eric Sandeen
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2010-01-28 16:56 UTC (permalink / raw)
  To: xfs-oss

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 filter that out.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

Index: xfstests/common.attr
===================================================================
--- xfstests.orig/common.attr
+++ xfstests/common.attr
@@ -58,7 +58,10 @@ _acl_filter_id()
 #
 _acl_ls()
 {
-    ls -ln $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
+    ls -ln $* |	\
+    sed "s/\(.*\)\. /\1 /" | \
+    awk '{ print $1, $3, $4, $NF }' | \
+    _acl_filter_id
 } 
 
 #

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfstests: filter selinux output in _acl_ls
  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 ` [PATCH V2] xfstests: filter selinux output in _acl_ls etc Eric Sandeen
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2010-01-28 23:34 UTC (permalink / raw)
  To: xfs-oss

Eric Sandeen wrote:
> 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 filter that out.

Hmm NAK this one for now; there are more places that need this
fixup, maybe an _ls_l() would be a good idea and put the filter
in one spot.

-Eric

> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
> 
> Index: xfstests/common.attr
> ===================================================================
> --- xfstests.orig/common.attr
> +++ xfstests/common.attr
> @@ -58,7 +58,10 @@ _acl_filter_id()
>  #
>  _acl_ls()
>  {
> -    ls -ln $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
> +    ls -ln $* |	\
> +    sed "s/\(.*\)\. /\1 /" | \
> +    awk '{ print $1, $3, $4, $NF }' | \
> +    _acl_filter_id
>  } 
>  
>  #
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] xfstests: filter selinux output in _acl_ls etc
  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
  2010-02-02 23:06   ` [PATCH V3] " Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2010-01-29  4:39 UTC (permalink / raw)
  To: xfs-oss

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V3] xfstests: filter selinux output in _acl_ls etc
  2010-01-29  4:39 ` [PATCH V2] xfstests: filter selinux output in _acl_ls etc Eric Sandeen
@ 2010-02-02 23:06   ` Eric Sandeen
  2010-02-03 10:56     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2010-02-02 23:06 UTC (permalink / raw)
  To: xfs-oss

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

V3: after talking to christoph, maybe a sed that looks
just for the ls -l chars might be better.

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 6424871..4425007 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/\(^[-rwxdlbcpsStT]*\)\. /\1 /"
+}
+
 _mount_opts()
 {
     case $FSTYP in

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V3] xfstests: filter selinux output in _acl_ls etc
  2010-02-02 23:06   ` [PATCH V3] " Eric Sandeen
@ 2010-02-03 10:56     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2010-02-03 10:56 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Tue, Feb 02, 2010 at 05:06:47PM -0600, Eric Sandeen wrote:
> 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>

Looks good,


Reviewed-by: Christoph Hellwig <hch@lst.de>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-03 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH V2] xfstests: filter selinux output in _acl_ls etc Eric Sandeen
2010-02-02 23:06   ` [PATCH V3] " Eric Sandeen
2010-02-03 10:56     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox