Subject: bug#13635: Strange ls bug (Combination of -a and --color)

From: Bob Proulx <[email-masked]>
Date: Wed, 6 Feb 2013 01:39:56 -0700

Joshua Rogers wrote:
> $ ls -ld csf
> drw------- 2 toil toil 4096 2013-02-05 19:26 csf

Yes. :-)

> So it seems that you may be correct.
> That chmod fixes the problem,

Yes.  You said you rsync'd data from another machine.  Was the
permissions copied from the remote machine the same there?

> But it is still a bug that it does not exit if it does have
> permissions, and has color on.

Sorry but I don't understand what you are saying.  The ls command
didn't create the directory with that permission.  The ls command
simply reported it.  That isn't a bug in ls.  And I am sure not a bug
in rsync either since I am sure that rsync just copied the source
permissions directly.  I think this is all expected behavior.

If either --color or -l is specified then it will cause ls to need to
stat(2) each entry in order to get information about it.  But it can't
stat without the 'x' bit allowing it.  So it reports what it can which
is simply the file name and nothing more.  And of course the program
does exit afterward.

Using 'ls -l' reports both "." and ".." and therefore they are listed
by name but without the missing attributes.  Using 'ls' without -l
does not report "." and ".." and therefore reported nothing but a
newline.

Bob