Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001147 [1003.1(2016)/Issue7+TC2] Shell and Utilities Editorial Enhancement Request 2017-06-15 20:41 2018-12-06 16:36
Reporter stephane View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Resolved  
Name Stephane Chazelas
Organization
User Reference
Section ls utility
Page Number 2923-2927
Line Number 96644,96693,96785->96793
Interp Status ---
Final Accepted Text Note: 0004173
Summary 0001147: ls -l -F/-p and symlinks
Description The ls spec currently says that with -F, some characters may be appended after each "pathname" to identify the type and after each "filename" for -p (though only for directories).

It doesn't say which filename/pathname it should apply to in the case of symlinks where both the file and the target of the symlink are listed like in ls -l/-n output.

I see different behaviours across implementations

GNU:

$ ls -lp
total 4
drwxr-xr-x 2 chazelas chazelas 4096 Jun 15 21:01 dir/
lrwxrwxrwx 1 chazelas chazelas    3 Jun 15 21:01 dir-link -> dir
prw-r--r-- 1 chazelas chazelas    0 Jun 15 20:59 fifo
lrwxrwxrwx 1 chazelas chazelas    4 Jun 15 20:59 fifo-link -> fifo
$ ls -lF
total 4
drwxr-xr-x 2 chazelas chazelas 4096 Jun 15 21:01 dir/
lrwxrwxrwx 1 chazelas chazelas    3 Jun 15 21:01 dir-link -> dir/
prw-r--r-- 1 chazelas chazelas    0 Jun 15 20:59 fifo|
lrwxrwxrwx 1 chazelas chazelas    4 Jun 15 20:59 fifo-link -> fifo|


busybox:

$ busybox ls -lp
total 4
drwxr-xr-x    2 chazelas chazelas      4096 Jun 15 21:01 dir/
lrwxrwxrwx    1 chazelas chazelas         3 Jun 15 21:01 dir-link -> dir/
prw-r--r--    1 chazelas chazelas         0 Jun 15 20:59 fifo
lrwxrwxrwx    1 chazelas chazelas         4 Jun 15 20:59 fifo-link -> fifo
$ busybox ls -lF
total 4
drwxr-xr-x    2 chazelas chazelas      4096 Jun 15 21:01 dir/
lrwxrwxrwx    1 chazelas chazelas         3 Jun 15 21:01 dir-link -> dir/
prw-r--r--    1 chazelas chazelas         0 Jun 15 20:59 fifo|
lrwxrwxrwx    1 chazelas chazelas         4 Jun 15 20:59 fifo-link -> fifo|


FreeBSD:

$ ls -lp
total 4
drwxr-xr-x  2 chazelas  chazelas  512 Jun 15 20:01 dir/
lrwxr-xr-x  1 chazelas  chazelas    3 Jun 15 20:01 dir-link -> dir
prw-r--r--  1 chazelas  chazelas    0 Jun 15 19:59 fifo
lrwxr-xr-x  1 chazelas  chazelas    4 Jun 15 19:59 fifo-link -> fifo
$ ls -lF
total 4
lrwxr-xr-x  1 chazelas  chazelas    6 Jun 15 20:05 broken@ -> broken
drwxr-xr-x  2 chazelas  chazelas  512 Jun 15 20:01 dir/
lrwxr-xr-x  1 chazelas  chazelas    3 Jun 15 20:01 dir-link@ -> dir
prw-r--r--  1 chazelas  chazelas    0 Jun 15 19:59 fifo|
lrwxr-xr-x  1 chazelas  chazelas    4 Jun 15 19:59 fifo-link@ -> fifo


Solaris 10:

$ ls -lp
total 10
lrwxrwxrwx   1 chazelas other          6 Jun 15 21:07 broken -> broken
drwxr-xr-x   2 chazelas other        512 Jun 15 21:01 dir/
lrwxrwxrwx   1 chazelas other          3 Jun 15 21:07 dir-link -> dir/
prw-r--r--   1 chazelas other          0 Jun 15 20:59 fifo
lrwxrwxrwx   1 chazelas other          4 Jun 15 21:07 fifo-link -> fifo
$ ls -lF
total 10
lrwxrwxrwx   1 chazelas other          6 Jun 15 21:07 broken -> broken
drwxr-xr-x   2 chazelas other        512 Jun 15 21:01 dir/
lrwxrwxrwx   1 chazelas other          3 Jun 15 21:07 dir-link -> dir/
prw-r--r--   1 chazelas other          0 Jun 15 20:59 fifo|
lrwxrwxrwx   1 chazelas other          4 Jun 15 21:07 fifo-link -> fifo

Desired Action Use "pathname" instead of "filename" consistently for "-p" and "-F".

For symlink in ls -lLF or ls -lLp (without -L/-H), leave it unspecified whether the character is appended to the symlink or its target or both, but when it's to the file, it should be based on the type as obtained from lstat(), and when it's to the target, it should be based on the type as obtained from stat().

For -p, for symlinks to directories, leave it unspecified whether a / is appended, but that if one is appended, it should be to the target of the symlink.

IMO, Solaris' ls -lF output of:
lrwxrwxrwx 1 chazelas other 4 Jun 15 21:07 fifo-link -> fifo

should be considered a bug, I would expect a @ after the link, or | after the fifo (the latter in that case for consistency with the "dir-link -> dir/").

We should probably make it clearer that by "target of the symlink" we mean after *full* symlink resolution (so not the target as in what appears after the "->" which may very well identify another symlink).
Tags tc3-2008
Attached Files

- Relationships

-  Notes
(0004173)
geoffclare (manager)
2018-12-06 16:31
edited on: 2018-12-06 16:35

On page 2925 line 96693 section ls, change:
Write a <slash> ('/') after each filename if that file is a directory.
to:
Write a <slash> ('/') after each pathname if that file is a directory.

On page 2926 line 96767 section ls, add a new paragraph:
In the formats specified below, except where specified otherwise the <tt><pathname></tt> field shall consist of the file's pathname and, if the -F or -p option is specified, any indicator character written after the pathname as described for those options.

On page 2926 line 96769,96771 section ls, change "filename" to "pathname".

On page 2927 line 96791 section ls, change:
... the <tt><pathname></tt> field shall be of the form:
"%s −> %s", <pathname of link>, <contents of link>
to:
... the <tt><pathname></tt> field shall be one of the following forms:
• "%s%s∆−>∆%s", <pathname of link>, <link type indicator>,
   <contents of link>

• "%s∆−>∆%s%s", <pathname of link>, <contents of link>,
   <file type indicator>

• "%s%s∆−>∆%s%s", <pathname of link>, <link type indicator>,
   <contents of link>, <file type indicator>
where <tt><link type indicator></tt> is an at-sign ('@') if the -F option is specified, or an empty string otherwise and <tt><file type indicator></tt> is the required indicator character, if any, for the file resolved from the symbolic link if the -F or -p option is specified, or an empty string otherwise. If pathname resolution fails when following the symbolic link, this shall not be treated as an error and the <tt><file type indicator></tt> field shall be an empty string.



- Issue History
Date Modified Username Field Change
2017-06-15 20:41 stephane New Issue
2017-06-15 20:41 stephane Name => Stephane Chazelas
2017-06-15 20:41 stephane Section => ls utility
2017-06-15 20:41 stephane Page Number => 2923-2927
2017-06-15 20:41 stephane Line Number => 96644,96693,96785->96793
2018-12-06 16:31 geoffclare Note Added: 0004173
2018-12-06 16:34 geoffclare Note Edited: 0004173
2018-12-06 16:35 geoffclare Note Edited: 0004173
2018-12-06 16:36 geoffclare Interp Status => ---
2018-12-06 16:36 geoffclare Final Accepted Text => Note: 0004173
2018-12-06 16:36 geoffclare Status New => Resolved
2018-12-06 16:36 geoffclare Resolution Open => Accepted As Marked
2018-12-06 16:36 geoffclare Tag Attached: tc3-2008


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker