GNU bug report logs - #9637
ls appends an indicator even if one is already present (--indicator-style=classify)

Previous Next

Package: coreutils;

Reported by: Philip Ganchev <phil.ganchev <at> gmail.com>

Date: Fri, 30 Sep 2011 16:11:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9637 in the body.
You can then email your comments to 9637 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#9637; Package coreutils. (Fri, 30 Sep 2011 16:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philip Ganchev <phil.ganchev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 30 Sep 2011 16:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Philip Ganchev <phil.ganchev <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: ls appends an indicator even if one is already present
	(--indicator-style=classify)
Date: Fri, 30 Sep 2011 13:42:09 +0300
"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.




Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Fri, 30 Sep 2011 17:38:02 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Fri, 30 Sep 2011 17:38:02 GMT) Full text and rfc822 format available.

Notification sent to Philip Ganchev <phil.ganchev <at> gmail.com>:
bug acknowledged by developer. (Fri, 30 Sep 2011 17:38:03 GMT) Full text and rfc822 format available.

Message #12 received at 9637-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Philip Ganchev <phil.ganchev <at> gmail.com>
Cc: 9637-done <at> debbugs.gnu.org
Subject: Re: bug#9637: ls appends an indicator even if one is already present
	(--indicator-style=classify)
Date: Fri, 30 Sep 2011 11:35:56 -0600
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#9637; Package coreutils. (Fri, 30 Sep 2011 19:46:02 GMT) Full text and rfc822 format available.

Message #15 received at 9637 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 9637 <at> debbugs.gnu.org, eblake <at> redhat.com
Subject: Re: bug#9637: ls appends an indicator even if one is already present
	(--indicator-style=classify)
Date: Fri, 30 Sep 2011 12:44:30 -0700
On 09/30/11 10:35, Eric Blake wrote:

> 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:

> Correct, and this behavior is required by POSIX:

But POSIX says nothing about --indicator-style=classify.

It may be that we'd like to change --indicator-style=classify to avoid appending
redundant slashes, which are indeed annoying, while keeping -F the way it is,
to stay compatible with POSIX.  Or perhaps we could add a new --indicator-style
option that would avoid appending redundant slashes.  Surely either one of these
would be a valid wish-list request?




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 29 Oct 2011 11:24:03 GMT) Full text and rfc822 format available.

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.