Bug 125447

Summary: ls -lZ gives bogus ACL results
Product: [Fedora] Fedora Reporter: Russell Coker <russell>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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: ---

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.