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 2017-06-15 20:41
Reporter stephane View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Stephane Chazelas
Organization
User Reference
Section ls utility
Page Number 2923-2927
Line Number 96644,96693,96785->96793
Interp Status ---
Final Accepted Text
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 No tags attached.
Attached Files

- Relationships

There are no notes attached to this issue.

- 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


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