This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix parameter passing containing quote/equal to Windows batch command


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]