On 08/26/2010 11:27 AM, Ralf Wildenhues wrote:
Hi Eric,
* Eric Blake wrote on Thu, Aug 26, 2010 at 01:18:16AM CEST:
On cygwin, attempts to do a glob() with a filename that contains
a backslash can issue a warning; but I have been unable to reliably
reproduce that in my environment (otherwise, I would have used it
as an example in the second patch). But see these links for an
example of where unintended globbing matters:
http://cygwin.com/ml/cygwin/2009-04/msg00531.html
I'm sure somebody thought that it would be a good idea to print that
warning, I can't imagine any reason that wouldn't outweigh its downsides
now though. Do you have a link to the corresponding implementation
discussion? Thanks.
The best I could find was the release announcement where it first appeared:
http://sourceware.org/ml/cygwin/2008-12/msg00225.html
The idea was that cygwin is intended to be a Posix-style platform,
except for the fact that it uses \ as an alternate spelling of / as a
directory separator; additionally, when using \, you lose cygwin's
emulation of Posix permissions (basically, using \ means that you are
going straight to Windows APIs and giving up some of the very reason
that you were using cygwin in the first place). Since the use of \ can
cause rather surprising behaviors because it shortcuts so much of
cygwin's emulation, it is worth encouraging people to use Posix-style
pathnames. Any open() or stat() (and thus any higher-layer function
like glob()) that encounters \ in the context of a file name is treated
as probable evidence of a user that does not understand why cygwin
favors / in file names, so it triggers a one-time warning per session
(maybe that's why I'm having a hard time reliably reproducing a setup to
spit out a warning; if my current session has already issued the
warning, then nothing else I do with \ will re-trigger it). And it is
an option controllable by the $CYGWIN variable (if you want to use \
without even the one-time warning, set CYGWIN=nodosfilewarning prior to
starting a cygwin session).
Since the one-time warning goes to the terminal rather than stderr, it
is unlikely to impact script behavior (that is, you can't capture it via
redirections, only to stumble later because you captured more text than
planned); conversely, since it goes straight to the terminal, it is
highly visible to the user if a package accidentally does anything that
accessed a string containing \ in a context of a file name.
If you (still) need somebody to test IRIX, OSF, Solaris 2.6, AIX, please
ping me. I definitely would feel a bit less worried if these changes
were thoroughly tested before the next release.
Agreed that more testing would be nice.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org