This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [PATCH] Fix parameter passing containing quote/equal to Windows batch command
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Fri, 24 Jan 2014 15:34:15 -0500
- Subject: Re: [PATCH] Fix parameter passing containing quote/equal to Windows batch command
- Authentication-results: sourceware.org; auth=none
- References: <CABDpyCh3VMDmd4Rb64Fz-cb2HzUwtZ0cY9T3xWUC8_O-eqKO6Q at mail dot gmail dot com>
- Reply-to: cygwin-patches at cygwin dot com
On Sun, Jan 19, 2014 at 10:02:56PM -0800, Daniel Dai wrote:
>We notice one issue when running a Windows batch command inside
>cygwin. Here is one example.
>
>Simple batch file:
>a.bat:
>echo %1
>
>Run it under cygwin:
>./a.bat a=b
>a
>
>./a.bat "a=b"
>a
>
>If we pass additional \"
>./a.bat "\"a=b\""
>"\"a
>
>There seems no way to pass a=b into bat.
>
>Attach quote.patch contains a fix. It does two things:
>1. If the parameter contains a equal sign, automatically add quote
>(similar to space, tab, new line, quote cygwin already do)
>2. If the parameter is already quoted, don't quote again
I don't understand the 2) part of the patch. If the parameter contains
a quote then the quote needs to be transmitted to the subprocess.
That's what is happening right now. That allows:
"\"foo bar\""
to be seen by the subprocess as "foo bar", quotes and all.
I'm going to add '=' to the list of special characters but I don't
see the need for the rest of that patch.
(Sorry for the delay in responding. A hard drive failure wiped out
my cygwin cross-compil stuff. Amazingly enough, I have recent
backups)
cgf