Bug 125447 - ls -lZ gives bogus ACL results
Summary: ls -lZ gives bogus ACL results
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-07 13:11 UTC by Russell Coker
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version: 5.2.1-15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-06-07 13:35:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Russell Coker 2004-06-07 13:11:46 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko)

Description of problem:
When you type "ls -Z" some entries will be reported as containing ACLs (through a '+' appended to the Unix permission mode) when they don't contain any ACLs.  This is due to the boolean representing the ACL state not being correctly initialised.

Stephen Smalley suggested the following patch to solve the problem:

--- ls.c.old    2004-06-07 08:51:24.000000000 -0400
+++ ls.c        2004-06-07 08:51:34.000000000 -0400
@@ -2528,7 +2528,7 @@
        }
 
 #if HAVE_ACL || USE_ACL
-      if (format == long_format)
+      if (format == long_format || format == security_format)
        {
          int n = file_has_acl (path, &f->stat);
          f->have_acl = (0 < n);


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Run "ls -lZ" on a SE Linux system and observe that one entry will falsely have a '+' appended to it.

Actual Results:  [root@fedora-se rjc]# ls -lZ /root
-rw-r--r--  root     rjc      root:object_r:user_home_ro_t     answers_to_questions.txt
-rw-r--r--+ root     root     root:object_r:user_home_ra_t     thanks.txt_append_only_dont_edit_with_vi
[root@fedora-se rjc]#

Expected Results:  [root@fedora-se rjc]# ls -lZ /root
-rw-r--r--  root     rjc      root:object_r:user_home_ro_t     answers_to_questions.txt
-rw-r--r--  root     root     root:object_r:user_home_ra_t     thanks.txt_append_only_dont_edit_with_vi
[root@fedora-se rjc]#

Additional info:

Comment 1 Tim Waugh 2004-06-07 13:35:56 UTC
I used a slightly different patch:
                                                                     
          
--- coreutils-5.2.1/src/ls.c    2004-06-04 09:55:05.010506573 +0100
+++ coreutils-5.2.1/src/ls.c    2004-06-07 14:18:07.448963915 +0100
@@ -2530,7 +2530,11 @@
        }
                                                                     
          
 #if HAVE_ACL || USE_ACL
-      if (format == long_format)
+      if (format == long_format
+#ifdef WITH_SELINUX
+         || format == security_format
+#endif
+         )
        {
          int n = file_has_acl (path, &f->stat);
          f->have_acl = (0 < n);
                                                                     
          
Fixed in coreutils-5.2.1-15.


Note You need to log in before you can comment on or make changes to this bug.