`ls' misbehaving?

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

 



Either I can't read a manpage, or the manpage is wrong, or `/bin/ls' is
misbehaving. All three options seem far-fetched.

I expect `ls -l foo' and `ls -lL bar' to produce the same results if
`bar' is a symbolic link to `foo'. But this doesn't happen.

   $ cd /tmp
   $ touch foo
   $ /bin/ls -l foo
   -rw-rw-r--    1 vladimir vladimir        0 05-08 10:47 foo
   $ ln -s foo bar
   $ /bin/ls -l bar
   lrwxrwxrwx    1 vladimir vladimir        3 05-08 10:47 bar -> foo
   $ /bin/ls -lL bar
   -rw-rw-r--    1 vladimir vladimir        0 05-08 10:47 bar

Here's the excerpt from the man page for `ls':

   -L, --dereference
          when showing file information for a symbolic link, show informa-
          tion for the file the link references rather than for  the  link
          itself

What am I missing?

--- Vladimir

P.S. POSIX seems to make an exception specifically for the case `-lL'.
The Single Unix Specification Issue 6 says: 
[http://www.opengroup.org/onlinepubs/007904975/toc.htm]

   -L  Evaluate the file information and file type for all symbolic links
       (whether named on the command line or encountered in a file
       hierarchy) to be those of the file referenced by the link, and not
       the link itself; however, ls shall write the name of the link
       itself and not the file referenced by the link. When -L is used
       with -l, write the contents of symbolic links in the long format
       (see the STDOUT section).

STDOUT

   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. 

------------------------------------------------------------------------
Vladimir G. Ivanovic                        http://leonora.org/~vladimir
2770 Cowper St.                                         vladimir@xxxxxxx
Palo Alto, CA 94306-2447                                 +1 650 678 8014



-- 
Psyche-list mailing list
Psyche-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux