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 ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature