bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -lF dereferences symbolic links - ?bug or feature?


From: Paul Eggert
Subject: Re: ls -lF dereferences symbolic links - ?bug or feature?
Date: Fri, 20 May 2005 14:36:45 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Eric J Haywiser <address@hidden> writes:

> I would expect the 2nd command to behave like this:
>
> address@hidden ~/coreutils-5.3.0/src/ls -lF
> total 1
> -rwxr-xr-x   exe*
> lrwxrwxrwx   n@ -> nonexistant
> lrwxrwxrwx   x@ -> exe

I can see your point: that would be logical, and it seems to be
consistent with what POSIX requires.  POSIX
<http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html> says
that -F is not supposed to follow symbolic links, and if that is the
case then coreutils is incorrect to output "x -> exe*" in the last
line (where the "*" is derived by following the symlink).

However, POSIX is not entirely clear in this area, as its formats for
ls -l outputs don't specify where the -F decorations are to be placed.

Also, this is longstanding behavior, both in coreutils and in
traditional UNIX.  For example, on Solaris 9:

   $ touch exe; chmod 755 exe
   $ ln -sf nonexistant n
   $ ln -sf exe x
   $ /usr/xpg4/bin/ls -lF
   total 4
   -rwxr-xr-x   1 eggert   eggert         0 May 20 14:27 exe*
   lrwxrwxrwx   1 eggert   eggert        11 May 20 14:28 n -> nonexistant
   lrwxrwxrwx   1 eggert   eggert         3 May 20 14:28 x -> exe*

Also, there is a usability argument for the traditional behavior in
common use.  First, the "@ ->" is redundant; anything with an arrow
must be a symbolic link, so there's little point to the "@".  Second,
it's useful for people to see the type of file the symbolic link is
pointing to.

I suspect that this is a bug in POSIX, since it is vague and in at
least one spot is specifying behavior that is contrary to common
practice.  Perhaps you can take this up with the POSIX committee by
filing an Aardvark?  <http://www.opengroup.org/austin/defectform.html>
In the mean time I'm afraid that I'm inclined to let sleeping dogs lie.

There is a similar issue with ls -lp.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]