[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'system-quote'
From: |
Eli Zaretskii |
Subject: |
Re: new module 'system-quote' |
Date: |
Wed, 09 May 2012 20:30:55 +0300 |
> From: Bruno Haible <address@hidden>
> Cc: address@hidden
> Date: Wed, 09 May 2012 11:20:56 +0200
>
> Eli Zaretskii wrote:
> > > The test suite of the module 'system-quote' reveals that the '*' is also
> > > special for CreateProcess on Windows and needs to be escaped
> >
> > What about '?'? Should we quote it as well?
>
> The statements that I have in the unit test
>
> check_one (interpreter, prog, "?");
> check_one (interpreter, prog, "foo?bar");
>
> did not fail (on Windows XP).
Which calls to CreateProcess that used '*' failed? You aren't saying
that the second argument to CreateProcess cannot include unquoted '*'
characters, are you?
> > wildcard
> > characters ? and * _cannot_ be protected from expansions on Windows
> > Vista and later. According to this:
> >
> >
> > http://connect.microsoft.com/VisualStudio/feedback/details/98756/vs2005-setargv-obj-wildcard-handling-broken
> >
> > MS modified their implementation of command-line globbing in versions
> > of MSVCRT starting with those systems, such that the wildcards are
> > expanded even if they are inside quotes.
>
> It sounds like they did the change in the newer MSVC runtime libraries,
> not in the old MSVCRT. Which would mean that mingw is not impacted, only
> MSVC built binaries.
Unfortunately, that's not so. The version of MSVCRT.DLL that ships
with Vista and later was updated with the new globbing code. (Its
version is also different: 7.0.7600.16385 vs 7.0.2600.5512 on XP.)
The function in question is __getmainargs; you can verify with
something like pexports that this function lives inside MSVCRT.DLL.
This is actually how I bumped into this: someone used on Windows 7
binaries I compiled on XP, and reported that they misbehaved with
quoted wildcards, something I couldn't reproduce at all.
> In any case, can someone please run the testsuite for this module on
> Windows 7 and report the results?
> $ ./gnulib-tool --create-testdir --dir=/tmp/testdir \
> --with-tests --single-configure system-quote
> then copy the directory to a Windows machine and configure it for mingw
> or MSVC use.
What is the command to run the test suite for the new module? Is it
$ cd gltests && make check-TESTS TESTS=test-system-quote.sh
? Also, is it sufficient to run the test program from the MSYS shell,
or should it also be run from cmd.exe?
I will try this tomorrow on Windows 7, if no one beats me to it.
> > This thread on the MinGW list:
> >
> >
> > http://sourceforge.net/mailarchive/forum.php?thread_name=83ipgb656k.fsf%40gnu.org&forum_name=mingw-users
> >
> > indicates that MinGW in some future version will probably invoke its
> > own globbing code instead, so at least MinGW programs will soon be
> > exempt from this terrible misfeature. But other programs, and in
> > particularly those supplied as part of Windows or compiled with the MS
> > compilers, cannot benefit from MinGW workarounds. So I think a caveat
> > is in order here, because sooner or later people will bump into this
> > and will be mightily surprised.
>
> Yes, this sounds dangerous. But can someone test what actually happens
> on Windows 7?
I already did (in addition to that report I got from someone else).
Quoted wildcards are indeed expanded. As another data point, see this
thread:
http://sourceforge.net/mailarchive/forum.php?thread_name=83wr9gv2fc.fsf%40gnu.org&forum_name=mingw-users
where Keith Marshall and myself got different results for a simple
program that just prints its argv[] array; it then turned out Keith
was using a newer version of MSVCRT. Several days ago, I tried that
program on a Windows 7 system, and got the same broken behavior that
Keith reported back then.
- Re: quotearg.c's shell_quoting_style and MinGW, (continued)
- Re: quotearg.c's shell_quoting_style and MinGW, Eli Zaretskii, 2012/05/06
- Re: quotearg.c's shell_quoting_style and MinGW, Bruno Haible, 2012/05/06
- Re: quotearg.c's shell_quoting_style and MinGW, Eli Zaretskii, 2012/05/06
- Re: quotearg.c's shell_quoting_style and MinGW, Bruno Haible, 2012/05/06
- new module 'system-quote', Bruno Haible, 2012/05/08
- Re: new module 'system-quote', Bruno Haible, 2012/05/08
- Re: new module 'system-quote', Eli Zaretskii, 2012/05/09
- Re: new module 'system-quote', Bruno Haible, 2012/05/09
- Re: new module 'system-quote',
Eli Zaretskii <=
- Re: new module 'system-quote', Bruno Haible, 2012/05/09
- Re: new module 'system-quote', Eli Zaretskii, 2012/05/10
- Re: new module 'system-quote', Bruno Haible, 2012/05/10
- Re: new module 'system-quote', Eli Zaretskii, 2012/05/10
- Re: new module 'system-quote', Paul Eggert, 2012/05/10
- Re: new module 'system-quote', Eli Zaretskii, 2012/05/10
- Re: new module 'system-quote', Bruno Haible, 2012/05/10
- Re: new module 'system-quote', Bruno Haible, 2012/05/10
- Re: new module 'system-quote', Eli Zaretskii, 2012/05/11
- Re: new module 'system-quote', Bruno Haible, 2012/05/12