[Top][All Lists]

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

bug#17878: Possible bug in GNU ls with -R

From: Eric Blake
Subject: bug#17878: Possible bug in GNU ls with -R
Date: Mon, 30 Jun 2014 07:23:32 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

tag 17878 notabug

On 06/29/2014 12:06 PM, address@hidden wrote:

>     $ ls -RF
>     .:
>     foo  bar*  baz

>> If more than one directory, or a combination of non-directory files
>> and directories are written, either as a result of specifying
>> multiple operands, or the -R option, each list of files within a
>> directory shall be preceded by:

> In the case described above, ls writes a listing for one directory (.)
> and does not list any non-directory files. Therefore, according to the
> above specification, the ".:" heading may not be printed, but GNU ls
> does do so. I suspect this is an oversight on the side of the
> developers of the GNU coreutils.

This is a mis-interpretation of POSIX.  You missed the "or the -R
option" phrase, which implies this behavior is turned on unconditionally
when a directory is listed recursively even if that directory does not
contain a mix of non-directory files and directories.  That is, the
behavior of listing a directory at the front is triggered either by
specifying multiple command line arguments (either 2 or more
directories, or 1 directory and at least one other argument); or by
using -R.  Another way of looking at it is that you are listing a
combination of directories and regular files - the directory '.'
(implicitly supplied by not giving any arguments) and the regular files
of its contents.

All other ls implementations behave the same.  This is not a bug in
coreutils.  I'm closing the report, although you can feel free to add
more comments.  If you think the wording in POSIX is awkward, then file
a bug there to get it cleaned up (http://austingroupbugs.net/)

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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