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

Daniel Dai daijyc@gmail.com
Fri Jan 24 23:14:00 GMT 2014


Hi, Christopher,

The current logic is: if the parameter contains quote, then put a
quote around the parameter (winf.cc:78). However, if the quote is in
the beginning/end, cygwin will still quote it, and thus double quoted
parameter (such as ""a=b"").

In the previous example, I want to pass equal sign into a bat file, I
know Windows bat will not see equal sign unless it is surrender by
quote, so I have to quote it (that's not true now with auto quote for
equal sign you just checked in). Then winf.cc:78 will detect the
quote, and put another quote around, so what Windows bat see is a
double quoted parameter. And surprisingly in this case, bat file does
not treat ""a=b"" as a single parameter, %1 becomes ""a, %2 becomes
b"". Anyway, my point for #2 is, if the parameter is quoted, it
usually means user want the executable see the parameter inside the
quote, it should be treated differently than quote in the middle of
the parameter, we shall not add another quote around it in this
scenario.

And thanks for checkin #1.

Thanks,
Daniel



More information about the Cygwin-patches mailing list