findutils-patches
[Top][All Lists]
Advanced

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

Re: [Findutils-patches] [PATCH] fts: reduce two or more trailing spaces


From: Eric Blake
Subject: Re: [Findutils-patches] [PATCH] fts: reduce two or more trailing spaces to just one, usually
Date: Tue, 04 Sep 2012 05:15:25 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/04/2012 05:09 AM, Jim Meyering wrote:
> Eric Blake wrote:
>> On 09/04/2012 04:57 AM, Eric Blake wrote:
>>>> * lib/fts.c (fts_open): Upon initialization, if a name ends in two
>>>> or more slashes, trim all but the final one.  But if a name consists
>>>> solely of two or more slashes, reduce it to "//", not to "/".
>>>>
>>>
>>> For two slashes, that is correct.  But trimming "///" to "//" is a
>>> violation of POSIX and fails on cygwin; "///" must be the same as "/",
>>> not "///".

Obviously, I meant:
same as "/", not "//".

> * lib/fts.c (fts_open): Upon initialization, if a name ends in two
> or more slashes, trim all but the final one.  But if a name consists
> solely of two slashes, don't modify it.  If it consists solely of
> three or more slashes, strip all but one.

Looks better, but now I'm starting to worry that it might negatively
impact findutils.  There, we use fts for traversal, but POSIX explicitly
states that the user's input string is preserved verbatim into the output:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
> Each path operand shall be evaluated unaltered as it was provided, including 
> all trailing <slash> characters;

and giving this example:
> Given two empty directories named foo and bar, the following command:
> find foo/// bar/// -name foo -o -name 'bar?*'
> prints only the line "foo///" .

and indeed, current findutils obeys this behavior.

-- 
Eric Blake   address@hidden    +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]