Bug 125447 - ls -lZ gives bogus ACL results
ls -lZ gives bogus ACL results
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-07 09:11 EDT by Russell Coker
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version: 5.2.1-15
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-06-07 09:35:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Russell Coker 2004-06-07 09:11:46 EDT
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 09:35:56 EDT
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.