GNU bug report logs - #16730
ls -dF double trailing slash bug

Previous Next

Package: coreutils;

Reported by: Radko Dinev <radko.dinev <at> gmail.com>

Date: Wed, 12 Feb 2014 16:41:01 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 16730 in the body.
You can then email your comments to 16730 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#16730; Package coreutils. (Wed, 12 Feb 2014 16:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Radko Dinev <radko.dinev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 12 Feb 2014 16:41:02 GMT) Full text and rfc822 format available.

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

From: Radko Dinev <radko.dinev <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: ls -dF double trailing slash bug
Date: Wed, 12 Feb 2014 16:45:01 +0200
[Message part 1 (text/plain, inline)]
user <at> host ~$ ls -dF somedir
somedir/

user <at> host ~$ ls -dF somedir/
somedir//

Notice the double trailing slash which shouldn't be there in the second
example.
[Message part 2 (text/html, inline)]

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Wed, 12 Feb 2014 16:53:01 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Wed, 12 Feb 2014 16:53:02 GMT) Full text and rfc822 format available.

Notification sent to Radko Dinev <radko.dinev <at> gmail.com>:
bug acknowledged by developer. (Wed, 12 Feb 2014 16:53:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: Radko Dinev <radko.dinev <at> gmail.com>, 16730-done <at> debbugs.gnu.org
Subject: Re: bug#16730: ls -dF double trailing slash bug
Date: Wed, 12 Feb 2014 09:52:31 -0700
[Message part 1 (text/plain, inline)]
tag 16730 notabug
thanks

On 02/12/2014 07:45 AM, Radko Dinev wrote:
> user <at> host ~$ ls -dF somedir
> somedir/
> 
> user <at> host ~$ ls -dF somedir/
> somedir//
> 
> Notice the double trailing slash which shouldn't be there in the second
> example.

Not a bug.  Consider:

$ touch '*'
$ chmod +x '*'
$ ls -F '*'
**

ls -F is merely appending the indicator on the end of the name as you
typed it in, even if it results in what looks like a double indicator.

Where it gets interesting is on systems where / and // are distinct, but
for consistency, we still do:

$ \ls -Fd / //
//  ///


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

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#16730; Package coreutils. (Wed, 12 Feb 2014 16:59:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: 16730 <at> debbugs.gnu.org, eblake <at> redhat.com, radko.dinev <at> gmail.com
Subject: Re: bug#16730: ls -dF double trailing slash bug
Date: Wed, 12 Feb 2014 16:58:50 +0000
On 02/12/2014 04:52 PM, Eric Blake wrote:
> tag 16730 notabug
> thanks
> 
> On 02/12/2014 07:45 AM, Radko Dinev wrote:
>> user <at> host ~$ ls -dF somedir
>> somedir/
>>
>> user <at> host ~$ ls -dF somedir/
>> somedir//
>>
>> Notice the double trailing slash which shouldn't be there in the second
>> example.
> 
> Not a bug.  Consider:
> 
> $ touch '*'
> $ chmod +x '*'
> $ ls -F '*'
> **

> ls -F is merely appending the indicator on the end of the name as you
> typed it in, even if it results in what looks like a double indicator.
> 
> Where it gets interesting is on systems where / and // are distinct, but
> for consistency, we still do:
> 
> $ \ls -Fd / //
> //  ///

Related discussion at:
http://lists.gnu.org/archive/html/coreutils/2013-05/msg00024.html

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#16730; Package coreutils. (Wed, 12 Feb 2014 17:00:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: 16730 <at> debbugs.gnu.org, radko.dinev <at> gmail.com
Subject: Re: bug#16730: ls -dF double trailing slash bug
Date: Wed, 12 Feb 2014 09:58:55 -0700
[Message part 1 (text/plain, inline)]
On 02/12/2014 09:52 AM, Eric Blake wrote:

> ls -F is merely appending the indicator on the end of the name as you
> typed it in, even if it results in what looks like a double indicator.
> 
> Where it gets interesting is on systems where / and // are distinct, but
> for consistency, we still do:
> 
> $ \ls -Fd / //
> //  ///

Further note that if you add --color, you can see the difference:

$ ls -Fd --color=always / // | od -tc
0000000 033   [   0   m 033   [   3   8   ;   5   ;   2   7   m   / 033
0000020   [   0   m   /  \n 033   [   3   8   ;   5   ;   2   7   m   /
0000040   / 033   [   0   m   /  \n
0000047

The file name you typed is colored, while the trailing / indicator added
by -F is not colored.

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

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#16730; Package coreutils. (Wed, 12 Feb 2014 17:17:02 GMT) Full text and rfc822 format available.

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

From: Radko Dinev <radko.dinev <at> gmail.com>
To: 16730 <at> debbugs.gnu.org
Subject: Re: bug#16730: ls -dF double trailing slash bug
Date: Wed, 12 Feb 2014 19:15:24 +0200
[Message part 1 (text/plain, inline)]
I was just wondering whether ls should normalize filenames that the user
typed.
Eric was kind enough to clarify that this would violate POSIX.

Thank you.


On Wed, Feb 12, 2014 at 7:11 PM, Radko Dinev <radko.dinev <at> gmail.com> wrote:

> I see. Thank you, Eric!
> All the best! :)
>
> P. S. I accidentally mailed you not paying attention it was not the bug
> I'm replying to but your email. I am sorry :)
>
>
> On Wed, Feb 12, 2014 at 7:08 PM, Eric Blake <eblake <at> redhat.com> wrote:
>
>> On 02/12/2014 10:03 AM, Radko Dinev wrote:
>> > $ ls -d somedir
>> > somedir
>> > $ ls -d somedir/
>> > somedir/
>> > $ ls -d ./somedir
>> > ./somedir
>> > $ ls -d ./somedir/
>> > ./somedir/
>> >
>> > It's the same directory being referred to in 4 different ways and shown
>> > with 4 different filenames in ls.
>> > Just wondering whether ls should somehow "normalize" the file name?
>>
>> https://rwmj.wordpress.com/2010/11/08/want-help-dont-email-me-directly/
>>
>> But no, ls should not normalize file names that the user typed, as it
>> would violate POSIX.
>>
>> --
>> Eric Blake   eblake redhat com    +1-919-301-3266
>> Libvirt virtualization library http://libvirt.org
>>
>>
>
[Message part 2 (text/html, inline)]

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

This bug report was last modified 11 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.