Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] Make attr ptest pass when selinux enabled
@ 2016-07-27  7:24 kai.kang
  2016-07-27  7:24 ` [PATCH 1/1] attr: make " kai.kang
  0 siblings, 1 reply; 2+ messages in thread
From: kai.kang @ 2016-07-27  7:24 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

The following changes since commit 36feb38045b7a2af86ece147fec54b0db3bf491f:

  linux-yocto: Update genericx86* SRCREVs for linux-yocto 4.4 (2016-07-21 07:48:53 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib kangkai/attr
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/attr

Kai Kang (1):
  attr: make ptest pass when selinux enabled

 meta/recipes-support/attr/attr.inc                 |  2 +-
 .../files/filter-selinux-attr-from-output.patch    | 41 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/attr/files/filter-selinux-attr-from-output.patch

-- 
2.9.2.368.g08bb350



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

* [PATCH 1/1] attr: make ptest pass when selinux enabled
  2016-07-27  7:24 [PATCH 0/1] Make attr ptest pass when selinux enabled kai.kang
@ 2016-07-27  7:24 ` kai.kang
  0 siblings, 0 replies; 2+ messages in thread
From: kai.kang @ 2016-07-27  7:24 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

When selinux is enabled, a file has a default attribute
"security.selinux" and the output of getfattr shows:

  # file: here
  security.selinux="system_u:object_r:lib_t:s0"

That always causes more output of command getfattr than expected.
Filter out selinux related attribute info, and if the file has only
selinux attribute info, remove its whole output.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-support/attr/attr.inc                 |  2 +-
 .../files/filter-selinux-attr-from-output.patch    | 41 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/attr/files/filter-selinux-attr-from-output.patch

diff --git a/meta/recipes-support/attr/attr.inc b/meta/recipes-support/attr/attr.inc
index 6860978..9f1a208 100644
--- a/meta/recipes-support/attr/attr.inc
+++ b/meta/recipes-support/attr/attr.inc
@@ -13,8 +13,8 @@ LIC_FILES_CHKSUM = "file://doc/COPYING;md5=2d0aa14b3fce4694e4f615e30186335f \
 
 SRC_URI = "${SAVANNAH_GNU_MIRROR}/attr/${BP}.src.tar.gz \
            file://run-ptest \
+           file://filter-selinux-attr-from-output.patch \
 "
-
 require ea-acl.inc
 
 # libdir should point to .la
diff --git a/meta/recipes-support/attr/files/filter-selinux-attr-from-output.patch b/meta/recipes-support/attr/files/filter-selinux-attr-from-output.patch
new file mode 100644
index 0000000..e1eefa7
--- /dev/null
+++ b/meta/recipes-support/attr/files/filter-selinux-attr-from-output.patch
@@ -0,0 +1,41 @@
+Upstream-Status: Pending
+
+When enable selinux, file has a default attribute:
+
+# file: here
+security.selinux="system_u:object_r:lib_t:s0"
+
+That cause there is always more output than expected.
+
+Filter out selinux related attribute info to make ptest pass.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+diff --git a/test/run b/test/run
+index cf15252..945741e 100755
+--- a/test/run
++++ b/test/run
+@@ -132,6 +132,23 @@ sub process_test($$$$) {
+        print "[$prog_line] \$ ", join(' ',
+              map { s/\s/\\$&/g; $_ } @$p), " -- ";
+        my $result = exec_test($prog, $in);
++
++       # filter selinux related attributes info
++       my @strip1;
++       my @strip2;
++       foreach (@$result) {
++           unless (/security.selinux=.*\n/) {
++               push @strip1, $_;
++           }
++       }
++       for (my $i = 0; $i <= $#strip1; $i++) {
++           if ($strip1[$i] =~ /^# file:.*/ && $strip1[$i+1] =~ /^\n$/) {
++               $i++;
++           } else {
++               push @strip2, $strip1[$i];
++           }
++       }
++       $result = \@strip2;
+        my @good = ();
+        my $nmax = (@$out > @$result) ? @$out : @$result;
+        for (my $n=0; $n < $nmax; $n++) {
-- 
2.9.2.368.g08bb350



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

end of thread, other threads:[~2016-07-27  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-27  7:24 [PATCH 0/1] Make attr ptest pass when selinux enabled kai.kang
2016-07-27  7:24 ` [PATCH 1/1] attr: make " kai.kang

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