Bug 448903 - Incorrect output of ls -lZ
Incorrect output of ls -lZ
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: coreutils (Show other bugs)
5.2
All Linux
low Severity low
: rc
: ---
Assigned To: Ondrej Vasik
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-29 09:04 EDT by James Findley
Modified: 2008-05-29 11:25 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-29 11:25:24 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 James Findley 2008-05-29 09:04:17 EDT
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 10:56:31 EDT
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 11:06:19 EDT
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 11:25:24 EDT
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.

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