summaryrefslogtreecommitdiffstats
path: root/recipes-support/attr
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2017-09-05 16:54:42 +0800
committerMark Hatle <mark.hatle@windriver.com>2017-09-08 13:20:27 -0500
commitbeaaa37217546c99a3960e4855d8b914f4377b97 (patch)
treea8969332f3befe0659120f3148615fc29d8cbb65 /recipes-support/attr
parent2aadc0d5fbd91606493463a12307579f660b6918 (diff)
downloadmeta-selinux-beaaa37217546c99a3960e4855d8b914f4377b97.tar.gz
attr: fix ptest failures when selinux enabled
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>
Diffstat (limited to 'recipes-support/attr')
-rw-r--r--recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch41
-rw-r--r--recipes-support/attr/attr_%.bbappend5
2 files changed, 46 insertions, 0 deletions
diff --git a/recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch b/recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch
new file mode 100644
index 0000000..e1eefa7
--- /dev/null
+++ b/recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch
@@ -0,0 +1,41 @@
1Upstream-Status: Pending
2
3When enable selinux, file has a default attribute:
4
5# file: here
6security.selinux="system_u:object_r:lib_t:s0"
7
8That cause there is always more output than expected.
9
10Filter out selinux related attribute info to make ptest pass.
11
12Signed-off-by: Kai Kang <kai.kang@windriver.com>
13---
14diff --git a/test/run b/test/run
15index cf15252..945741e 100755
16--- a/test/run
17+++ b/test/run
18@@ -132,6 +132,23 @@ sub process_test($$$$) {
19 print "[$prog_line] \$ ", join(' ',
20 map { s/\s/\\$&/g; $_ } @$p), " -- ";
21 my $result = exec_test($prog, $in);
22+
23+ # filter selinux related attributes info
24+ my @strip1;
25+ my @strip2;
26+ foreach (@$result) {
27+ unless (/security.selinux=.*\n/) {
28+ push @strip1, $_;
29+ }
30+ }
31+ for (my $i = 0; $i <= $#strip1; $i++) {
32+ if ($strip1[$i] =~ /^# file:.*/ && $strip1[$i+1] =~ /^\n$/) {
33+ $i++;
34+ } else {
35+ push @strip2, $strip1[$i];
36+ }
37+ }
38+ $result = \@strip2;
39 my @good = ();
40 my $nmax = (@$out > @$result) ? @$out : @$result;
41 for (my $n=0; $n < $nmax; $n++) {
diff --git a/recipes-support/attr/attr_%.bbappend b/recipes-support/attr/attr_%.bbappend
new file mode 100644
index 0000000..6be8191
--- /dev/null
+++ b/recipes-support/attr/attr_%.bbappend
@@ -0,0 +1,5 @@
1inherit selinux
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
4
5SRC_URI += "${@target_selinux(d, 'file://fix-ptest-failures-when-selinux-enabled.patch')}"