[PATCH 2/4] selinux-testsuite: allow the file test to work with all coreutils versions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux