t takahashi wrote:
> This is hilarious -- a program whose basic form has existed since
> around the first moon landing has either you or me very confused.
> 
> On 4/27/05, Bob Proulx <[EMAIL PROTECTED]> wrote:
> > > #ls as
> > > af
> 
> af is the contents of the directory.

Yes.

> > > #ls -l as
> > > lrwxrwxrwx  1 root root 2 Apr 27 19:38 as -> ad
> 
> as is not the contents of the directory.  Atari!

Yes.

But what is the problem there?  My confusion is why you think there is
a problem?  The above seems perfectly expected behavior.  [I don't see
any of my stones under threat.  They all have two eyes.]

'as' is a symlink that points to a directory.  The 'ls' program is
listing the directory.  That is expected behavior.  If you want 'ls'
to say what type of file it is you need to add the -F, --classify
option to the command.  It is a typical user alias.

  ls as
  af

  ls -F as
  as@

I think that is what you want.  In that case use an alias or script
wrapper and specify the option.

> > It is supposed to behave that way.  But your statement confuses me.
> > What other way would you expect it to behave?  What documentation and
> > for which program of mkdir, touch, ln or ls would you change?
> 
> I would change "ls as" to list the symlink, and document "ls as/".

That would break standards conformance and existing practice.  That
would be incorrect.  That would be a bug.  You can follow the
standards for 'ls' here.

  http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html

Here is the important part:

    If none of the -d, -F, or -l options are specified, or the -H or
    -L options are specified, for each operand that names a file of
    type symbolic link to a directory, ls shall write the names of
    files contained within the directory as well as any requested,
    associated information.

The 'ls' command must list the contents of the directory.

> This is hilarious -- a program whose basic form has existed since
> around the first moon landing has either you or me very confused.

But symlinks were added to the system much later.  They were not
around during the moonshot era.  They were added by Mike Accetta in
BSD, but I can't find an exact date.  Well after the last Apollo
mission.

> Or I would change "ls -l as" to list the directory and get rid of the
> slash trick.  It's miai.

This is not an either this or that situation.  It is not miai.

In GNU/UNIX a file may have many names.  All are valid.  A file may be
hard linked or soft linked.  Since soft links were designed to operate
similar to hard links the behavior is also similar.  If you had hard
linked ad to as (possible on traditional filesystems using the 'link'
command) then the current behavior of 'ls' would certainly be beyond
debate.  Symlinks work similarly to hard links and so the behavior of
'ls' in that case is the same.  Symlinks are designed to be
transparent as much as possible.

> Another option is to document that ls and ls -l are nonorthogonal for
> reasons that are mysterious.  :-)
> 
> > This is a serious question.  The above is in exactly the order of your
> > example.  What did you expect?  What was unclear?
> 
> Lemme throw that back at you!  Is this a ko?

This is not a Debian bug.  I suggest this bug be closed.

If you want further discussion on this topic please take it upstream
to the discussion list <bug-coreutils@gnu.org>.  That is the
appropriate place to continue this thread.  Or possibly even further
upstream to POSIX for discussion of changing the standard.

> > Bob Proulx <[EMAIL PROTECTED]>
> 
> Nice to meet you.

Pleased to meet you as well.

Bob

> P.S. to others: atari, miai, and ko are just jokes for Bob; please ignore 
> them.

:-)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to