GNU bug report logs -
#17878
Possible bug in GNU ls with -R
Previous Next
Reported by: fuz <at> fuz.su
Date: Sun, 29 Jun 2014 18:06:02 UTC
Severity: normal
Tags: notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
Message #12 received at 17878-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tag 17878 notabug
thanks
On 06/29/2014 12:06 PM, fuz <at> fuz.su 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
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 11 years and 16 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.