public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dwight Engen <dwight.engen@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: [PATCH] xfstests: generic/318 use symbolic namespaced ids
Date: Thu, 24 Oct 2013 16:11:55 -0400	[thread overview]
Message-ID: <20131024161155.080eabad@oracle.com> (raw)
In-Reply-To: <20131024154414.GB19055@infradead.org>

Christoph, I think the following should fix 318 for you.

--

- use namespace ids that correspond to the initial acl ids
  and match them symbolically in the output

- also ensure that all uids have a mapping in the namespace
  so we don't get the unmapped uid (65534) in the output

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
---
 tests/generic/318     |   21 +++++++++++++++++++--
 tests/generic/318.out |   20 ++++++++++----------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/tests/generic/318 b/tests/generic/318
index d3bce51..810cff4 100755
--- a/tests/generic/318
+++ b/tests/generic/318
@@ -63,6 +63,23 @@ _require_scratch
 _need_to_be_root
 _acl_setup_ids
 _require_acls
+ns_acl1=0
+ns_acl2=`expr $acl2 - $acl1`
+ns_acl3=`expr $acl3 - $acl1`
+
+_getfacl_filter_nsid()
+{
+    sed \
+       -e "s/user:$ns_acl1/user:nsid1/" \
+       -e "s/user:$ns_acl2/user:nsid2/" \
+       -e "s/user:$ns_acl3/user:nsid3/" \
+       -e "s/group:$ns_acl1/group:nsid1/" \
+       -e "s/group:$ns_acl2/group:nsid2/" \
+       -e "s/group:$ns_acl3/group:nsid3/" \
+       -e "s/: $ns_acl1/: nsid1/" \
+       -e "s/: $ns_acl2/: nsid2/" \
+       -e "s/: $ns_acl3/: nsid3/"
+}
 
 _print_getfacls()
 {
@@ -70,7 +87,7 @@ _print_getfacls()
     getfacl --absolute-names -n $file 2>/dev/null | _filter_scratch | _getfacl_filter_id
 
     echo "From user_ns"
-    $nsexec -U -M "0 $acl1 1000" -G "0 $acl2 1000" getfacl --absolute-names -n $file  2>/dev/null | _filter_scratch | _getfacl_filter_id
+    $nsexec -U -M "0 $acl1 1000" -G "0 $acl1 1000" getfacl --absolute-names -n $file 2>/dev/null | _filter_scratch | _getfacl_filter_nsid
 }
 
 umount $SCRATCH_DEV >/dev/null 2>&1
@@ -85,7 +102,7 @@ chown $acl1.$acl1 $file
 # set acls from init_user_ns, to be checked from inside the userns
 setfacl -n -m u:$acl2:rw,g:$acl2:r $file
 # set acls from inside userns, to be checked from init_user_ns
-$nsexec -s -U -M "0 $acl1 1000" -G "0 $acl2 1000" setfacl -n -m u:root:rx,g:root:x $file
+$nsexec -s -U -M "0 $acl1 1000" -G "0 $acl1 1000" setfacl -n -m u:root:rx,g:$ns_acl2:x $file
 
 _print_getfacls
 
diff --git a/tests/generic/318.out b/tests/generic/318.out
index e2b42a4..6ff2bf8 100644
--- a/tests/generic/318.out
+++ b/tests/generic/318.out
@@ -13,13 +13,13 @@ other::r--
 
 From user_ns
 # file: SCRATCH_MNT/file1
-# owner: 0
-# group: 65534
+# owner: nsid1
+# group: nsid1
 user::rw-
-user:0:r-x	#effective:r--
-user:1:rw-	#effective:r--
+user:nsid1:r-x	#effective:r--
+user:nsid2:rw-	#effective:r--
 group::r--
-group:0:--x	#effective:---
+group:nsid2:--x	#effective:---
 mask::r--
 other::r--
 
@@ -39,13 +39,13 @@ other::r--
 
 From user_ns
 # file: SCRATCH_MNT/file1
-# owner: 0
-# group: 65534
+# owner: nsid1
+# group: nsid1
 user::rw-
-user:0:r-x	#effective:r--
-user:1:rw-	#effective:r--
+user:nsid1:r-x	#effective:r--
+user:nsid2:rw-	#effective:r--
 group::r--
-group:0:--x	#effective:---
+group:nsid2:--x	#effective:---
 mask::r--
 other::r--
 
-- 
1.7.1

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

  parent reply	other threads:[~2013-10-24 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 15:44 xfstest 318 Christoph Hellwig
2013-10-24 17:05 ` Dwight Engen
2013-10-24 20:11 ` Dwight Engen [this message]
2013-10-25  9:31   ` [PATCH] xfstests: generic/318 use symbolic namespaced ids Christoph Hellwig
2013-11-04 20:11     ` Rich Johnston
2013-11-04 20:21       ` Rich Johnston
2013-11-04 20:25   ` Rich Johnston

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=20131024161155.080eabad@oracle.com \
    --to=dwight.engen@oracle.com \
    --cc=hch@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox