Bug 448903

Summary: Incorrect output of ls -lZ
Product: Red Hat Enterprise Linux 5 Reporter: James Findley <james.findley>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.2   
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-29 15:25:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Findley 2008-05-29 13:04:17 UTC
Description of problem:

ls -lZ produces incorrect output, contrasted with ls -Zl which is correct.

The former does not display the mtime and size columns, overwriting them with 
the SELinux context, whereas the latter shows all columns correctly.

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

coreutils-5.97-12.1.el5
coreutils-5.97-14.el5

How reproducible:

Always

Steps to Reproduce:
1. Enter ls -lZ at a console

  
Actual results:
 
The following columns are displayed:

Permissions, UID, GID, Security Context, Filename

Expected results:

The following columns are displayed:

Permissions, UID, GID, Size, Modification time, Security Context, Filename

Additional info:

Tested on RHEL 5.1 and 5.2, with the above versions of coreutils

Comment 1 Ondrej Vasik 2008-05-29 14:56:31 UTC
Thanks for report. I wouldn't say which one is correct and which one not. -Z is
option switch which enables security format and displaying of context. -l is
option switch, which enables long format. Therefore with ls -lZ you will get
security format with displayed context(long format option was overruled by
security format) and with ls -Zl you will get long format with displayed
security context(as security format is overruled by long format). You could have
similar "strange" and expected results with ls -lm vs. ls -ml . For long format
ls with security context you could use ls --lcontext as well. I don't see any
bugs on that behaviour and would suggest to close that bugzilla NOTABUG. Are you
satisfied with that explanation (ls --help states correctly, that -Z option
alone doesn't show modification time)?

Comment 2 James Findley 2008-05-29 15:06:19 UTC
The issue with the current behaviour in my opinion is that the order the 
arguments are given matters, which is likely to cause confusion and is not 
mentioned in the man page.  Also ideally the order of arguments shouldn't 
matter.
However, this is a fairly small issue so I can understand that fixing it may 
not be worthwhile.

Comment 3 Ondrej Vasik 2008-05-29 15:25:24 UTC
You are right and I agree with you that it is quiet confusing. Actually - man
pages are generally not updated by coreutils upstream - and only texinfo/info
documentation is maintained for quiet a long time. So I would suggest to use
this source of information as is usually more detailed. Anyway - SELinux things
in coreutils are recent changes and they are not well documented - ls part is
missing completely afaik (and there are already some bugzillas about coreutils
SELinux documentation filled). The only place with a few words about ls SELinux
behaviour is at the moment long option --help. Closing that bugzilla NOTABUG, as
this behaviour is expected and I'm quiet sure it will not change for RHEL-5. But
I will send an email to upstream mailing list to discuss the issue with the ls
order of format arguments to have it more clear documented or changed in future.