Skip to contentSkip to conversation

file: replace 'ls -Z' with 'ls -lZ' for consistent results

PATCH In review Paul Moore 2 participants 6 messages Aug 28, 2014 – Aug 29, 2014 SELinux security module

lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 file: replace 'ls -Z' with 'ls -lZ' for consistent results

I'm not sure the exact date of the change, but 'ls -Z' on Rawhide is a bit different than in the past; the output now looks like this:

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

This patch converts the testsuite to use 'ls -lZ' which appears to be consistent.

---
 tests/file/test |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/file/test +2 -2
index e6ed44d..1c8485a 100755
@@ -45,9 +45,9 @@ system "chcon -t fileop_exec_t $basedir/wait_io 2>&1 > /dev/null";
 #
 # Get the SID of the good file.
 #
-$output = `ls -Z $basedir/temp_file`;
+$output = `ls -lZ $basedir/temp_file`;
 @arr = split(' ', $output);
-$good_file_sid = $arr[3];
+$good_file_sid = $arr[4];
 
 #
 # Attempt to access a restricted file as the 'good' domain.  The first test
#1 lore raw
Quoted 5 lines · Paul Moore

I'm not sure the exact date of the change, but 'ls -Z' on Rawhide is a bit different than in the past; the output now looks like this:

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

That seems very wrong - who knows how many userspace scripts may rely on
the output of ls -Z having a given format? Is this a change in
upstream coreutils or Fedora-specific?

Quoted 32 lines

This patch converts the testsuite to use 'ls -lZ' which appears to be consistent.

---
 tests/file/test |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/file/test +2 -2
index e6ed44d..1c8485a 100755
@@ -45,9 +45,9 @@ system "chcon -t fileop_exec_t $basedir/wait_io 2>&1 > /dev/null";
 #
 # Get the SID of the good file.
 #
-$output = `ls -Z $basedir/temp_file`;
+$output = `ls -lZ $basedir/temp_file`;
 @arr = split(' ', $output);
-$good_file_sid = $arr[3];
+$good_file_sid = $arr[4];
 
 #
 # Attempt to access a restricted file as the 'good' domain.  The first test

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

author
#2 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 5 lines · Paul Moore

I'm not sure the exact date of the change, but 'ls -Z' on Rawhide is

a bit different than in the past; the output now looks like this:

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

That seems very wrong - who knows how many userspace scripts may rely on
the output of ls -Z having a given format? Is this a change in
upstream coreutils or Fedora-specific?

It does seems a bit odd to me too, but I'm in need of a quick solution and changing to using the '-l' flag served that purpose. I can try to track down the source of the change, but it probably isn't going to happen today.

In the meantime, using '-l' doesn't hurt anything, and it works.

Signature · 2 lines
paul moore
security and virtualization @ redhat
#3 lore raw
Quoted 12 lines · Paul Moore
Quoted 10 lines · Stephen Smalley
Quoted 5 lines · Paul Moore

I'm not sure the exact date of the change, but 'ls -Z' on Rawhide is

a bit different than in the past; the output now looks like this:

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

That seems very wrong - who knows how many userspace scripts may rely on
the output of ls -Z having a given format? Is this a change in
upstream coreutils or Fedora-specific?

Quoted 5 lines

It does seems a bit odd to me too, but I'm in need of a quick solution and changing to using the '-l' flag served that purpose. I can try to track down the source of the change, but it probably isn't going to happen today.

In the meantime, using '-l' doesn't hurt anything, and it works.

...on rawhide, maybe. It breaks the test on Fedora 20, and presumably on every older Fedora and RHEL release.

author
#4 lore raw
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Paul Moore
Quoted 10 lines · Stephen Smalley
Quoted 5 lines · Paul Moore

I'm not sure the exact date of the change, but 'ls -Z' on Rawhide is

a bit different than in the past; the output now looks like this:

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

That seems very wrong - who knows how many userspace scripts may rely on
the output of ls -Z having a given format? Is this a change in
upstream coreutils or Fedora-specific?

It does seems a bit odd to me too, but I'm in need of a quick solution and changing to using the '-l' flag served that purpose. I can try to track down the source of the change, but it probably isn't going to happen today.

Quoted 4 lines
Quoted 1 line

In the meantime, using '-l' doesn't hurt anything, and it works.

...on rawhide, maybe. It breaks the test on Fedora 20, and presumably on every older Fedora and RHEL release.

I didn't realize the '-lZ' format changed as well ... sigh.

Signature · 2 lines
paul moore
security and virtualization @ redhat
author
#5 lore raw
In reply to Stephen Smalley
Quoted 5 lines · Stephen Smalley
Quoted 1 line · Paul Moore

In the meantime, using '-l' doesn't hurt anything, and it works.

...on rawhide, maybe. It breaks the test on Fedora 20, and presumably on every older Fedora and RHEL release.

Just to add a follow-up to the list ... we dug into this a bit more off-list and it appears that when Fedora Rawhide moved to coreutils-8.23 from 8.22 they adopted the upstream coreutils output formatting.

Signature · 2 lines
paul moore
security and virtualization @ redhat