View Issue Details

IDProjectCategoryView StatusLast Update
00001171003.1(2008)/Issue 7Shell and Utilitiespublic2013-04-16 13:06
Reportergeoffclare Assigned Toajosey  
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Sectionls
Page Number2867, 2868
Line Number93866, 93873, 93892
Interp StatusApproved
Final Accepted Text0000117:0000196
Summary0000117: ls -l output format and "number of bytes"
DescriptionThe ls -l output format requires the "number of bytes in the file"
to be output for all file types, except character special and block
special files. This is inconsistent with the requirements for the
st_size field of struct stat: the <sys/stat.h> page in XBD7
describes its contents for regular files, symbolic links, shared
memory objects and typed memory objects, and says "For other file
types, the use of this field is unspecified." In particular,
st_size is unspecified for directories, FIFOs and sockets, whereas
ls -l is required to output the number of bytes in these files.
In practice, implementations of ls just output whatever value is
returned in st_size for these file types.

There is a related problem with the stated exception for character
special and block special files (line 93892). Although it says the
file size may be replaced by "implementation-defined information
associated with the device", it doesn't state an exception for the
format specifier used, which is %u. This means the output must
contain a single number in place of the size, whereas existing
practice is to output two numbers separated by a comma and a space.
Desired ActionAt line 93864, change:

    If the -l option is specified without -L, the following
    information shall be written:

    "%s %u %s %s %u %s %s\n", <file mode>, <number of links>,
      <owner name>, <group name>, <number of bytes in the file>,
      <date and time>, <pathname>

    If the file is a symbolic link, this information shall be about
    the link itself and the <pathname> field shall be of the form:

    "%s -> %s", <pathname of link>, <contents of link>

    If both -l and -L are specified, the following information shall
    be written:

    "%s %u %s %s %u %s %s\n", <file mode>, <number of links>,
      <owner name>, <group name>, <number of bytes in the file>,
      <date and time>, <pathname of link>

    where all fields except <pathname of link> shall be for the file
    resolved from the symbolic link.

to:

    If the -l option is specified, the following information shall
    be written for files other than character special and block
    special files:

    "%s %u %s %s %u %s %s\n", <file mode>, <number of links>,
      <owner name>, <group name>, <size>, <date and time>,
      <pathname>

    If the -l option is specified, the following information shall
    be written for character special and block special files:

    "%s %u %s %s %s %s %s\n", <file mode>, <number of links>,
      <owner name>, <group name>, <device info>, <date and time>,
      <pathname>

    In both cases if the file is a symbolic link and the -L option is
    also specified, this information shall be for the file resolved
    from the symbolic link except that the <pathname> field shall
    contain the pathname of the symbolic link itself. If the file is
    a symbolic link and the -L option is not specified, this
    information shall be about the link itself and the <pathname>
    field shall be of the form:

    "%s -> %s", <pathname of link>, <contents of link>

After line 93879 add two new paragraphs:

    The <size> field shall contain the value that would be returned
    for the file in the st_size field of struct stat (see [xref to
    XBD <sys/stat.h>]). Note that for some file types this value is
    unspecified.

    The <device info> field shall contain implementation-defined
    information associated with the device in question.

At line 93892 delete:

    If the file is a character special or block special file, the size
    of the file may be replaced with implementation-defined
    information associated with the device in question.
Tagstc1-2008

Activities

ajosey

2009-08-13 16:12

manager   bugnote:0000196

Last edited: 2009-10-12 05:58

Interpretation response
------------------------
The standard states the requirements for the output of the ls utility
and conforming implementations must conform to this. However, concerns
have been raised about this which are being referred to the sponsor.


Rationale:
-------------
None.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------

Make the change suggested by the submitter

Issue History

Date Modified Username Field Change
2009-07-10 10:59 geoffclare New Issue
2009-07-10 10:59 geoffclare Status New => Under Review
2009-07-10 10:59 geoffclare Assigned To => ajosey
2009-07-10 10:59 geoffclare Name => Geoff Clare
2009-07-10 10:59 geoffclare Organization => The Open Group
2009-07-10 10:59 geoffclare Section => ls
2009-07-10 10:59 geoffclare Page Number => 2867, 2868
2009-07-10 10:59 geoffclare Line Number => 93866, 93873, 93892
2009-08-13 16:12 ajosey Interp Status => Pending
2009-08-13 16:12 ajosey Note Added: 0000196
2009-08-13 16:12 ajosey Status Under Review => Interpretation Required
2009-08-13 16:12 ajosey Resolution Open => Accepted
2009-09-17 15:41 nick Interp Status Pending => Proposed
2009-10-12 05:58 ajosey Note Edited: 0000196
2009-10-12 05:59 ajosey Interp Status Proposed => Approved
2009-10-12 05:59 ajosey Final Accepted Text => 0000117:0000196
2010-09-21 11:09 geoffclare Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Interpretation Required => Closed