All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <pmoore@redhat.com>
To: selinux@tycho.nsa.gov
Subject: [PATCH 2/4] selinux-testsuite: allow the file test to work with all coreutils versions
Date: Mon, 09 Feb 2015 18:06:35 -0500	[thread overview]
Message-ID: <20150209230635.2579.7110.stgit@localhost> (raw)
In-Reply-To: <20150209230426.2579.84520.stgit@localhost>

Prior to coreutils v8.23 the 'ls -Z' output looked like the following:

  # /bin/ls -Z test
  -rw-r--r--. root root unconfined_u:object_r:user_tmp_t:s0 test

However, with the coreutils v8.23 release the output changed to:

  # /bin/ls -Z test
  system_u:object_r:test_file_t:s0 test

This patch attempts to detect the version of /bin/ls in use and adjusts
accordingly.

Signed-off-by: Paul Moore <pmoore@redhat.com>
---
 0 files changed

diff --git a/tests/file/test b/tests/file/test
index e6ed44d..e52744f 100755
--- a/tests/file/test
+++ b/tests/file/test
@@ -47,7 +47,11 @@ system "chcon -t fileop_exec_t $basedir/wait_io 2>&1 > /dev/null";
 #
 $output = `ls -Z $basedir/temp_file`;
 @arr = split(' ', $output);
-$good_file_sid = $arr[3];
+if (index($arr[0], ":") != -1) {
+	$good_file_sid = $arr[0]
+} else {
+	$good_file_sid = $arr[3]
+}
 
 #
 # Attempt to access a restricted file as the 'good' domain.  The first test

  parent reply	other threads:[~2015-02-09 23:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 23:06 [PATCH 0/4] Fix the selinux-testsuite for RHEL5,6,7 and Rawhide Paul Moore
2015-02-09 23:06 ` [PATCH 1/4] selinux-testsuite: add improved OS detection Paul Moore
2015-02-09 23:06 ` Paul Moore [this message]
2015-02-09 23:06 ` [PATCH 3/4] selinux-testsuite: enable task_setscheduler to work with cgroups Paul Moore
2015-02-09 23:06 ` [PATCH 4/4] selinux-testsuite: allow unconfined_t entrypoint to test_nnp_bounded_exec_t Paul Moore

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=20150209230635.2579.7110.stgit@localhost \
    --to=pmoore@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /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.