GNU bug report logs -
#9637
ls appends an indicator even if one is already present (--indicator-style=classify)
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Fri, 30 Sep 2011 11:35:56 -0600
with message-id <4E85FDFC.3010603 <at> redhat.com>
and subject line Re: bug#9637: ls appends an indicator even if one is already present (--indicator-style=classify)
has caused the debbugs.gnu.org bug report #9637,
regarding ls appends an indicator even if one is already present (--indicator-style=classify)
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
9637: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9637
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
"Ls --indicator-style=classify" always appends a slash to the names of
directories. For example:
ls -d */
dir1// dir2//
ls -d */////
dir1////// dir2//////
Ls should check if an indicator is already present after the end of
the file name, and append it only if it is not.
[Message part 3 (message/rfc822, inline)]
tag 9637 notabug
thanks
On 09/30/2011 04:42 AM, Philip Ganchev wrote:
> "Ls --indicator-style=classify" always appends a slash to the names of
> directories. For example:
>
> ls -d */
>
> dir1// dir2//
Correct, and this behavior is required by POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
-F
Do not follow symbolic links named as operands unless the -H or -L
options are specified. Write a <slash> ( '/' ) immediately after each
pathname that is a directory, an <asterisk> ( '*' ) after each that is
executable, a <vertical-line> ( '|' ) after each that is a FIFO, and an
at-sign ( '@' ) after each that is a symbolic link. For other file
types, other symbols may be written.
-p
Write a <slash> ( '/' ) after each filename if that file is a
directory.
Neither of those options mention that the slash may be omitted if the
user's command-line option already included a slash. We'd have to take
it up with the POSIX folks to get that changed, before we could change
coreutils' behavior.
In particular, we have to be careful that:
ls -p / // ///
does not make the results ambiguous. That is, while / and /// are
necessarily the same directory, / and // can differ, so if we omit
adding an extra slash because one is already present, then we risk
confusing scripts that depend on stripping the trailing slash added by
-p to convert the traditional output back into the proper directory names.
>
> Ls should check if an indicator is already present after the end of
> the file name, and append it only if it is not.
It's worth requesting that as an enhancement to POSIX, but I don't see
coreutils making any changes here unless a POSIX change is made first to
permit such an output optimization.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
This bug report was last modified 13 years and 294 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.