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

2014-01-26 Thread Daniel Dai
Yes, that's the Unix behavior. However, bat file will eat the quote. If you pass "a=b" to bat, you will only get a=b. That's why I can quote the parameters containing equal sign. But anyway, if cygwin automatically quote equal sign, I don't need to quote the parameter. That should enough to solve m

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

2014-01-24 Thread Christopher Faylor
On Fri, Jan 24, 2014 at 03:14:30PM -0800, Daniel Dai wrote: >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

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

2014-01-24 Thread Daniel Dai
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

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

2014-01-24 Thread Christopher Faylor
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\"

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

2014-01-21 Thread Daniel Dai
Max, Yes, you are right. I did a "echo %*" mistakenly in my bat script on Windows. In terms of consistency, this one does makes a difference (parameter contains space): int main(int argc, char** argv) { execl("a.bat", "a.bat", "a b"); return 0; } On cygwin, $1=="a b", on Windows however,

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

2014-01-21 Thread Max Polk
On 1/21/2014 4:27 AM, Daniel Dai wrote: Max, Thanks for your reply. Yes, the double quote issue can be reproducible from command line, but not the equal sign. Let's demonstrate the equal sign issue with a C program: #include "unistd.h" int main(int argc, char** argv) { execl("a.bat", "a.

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

2014-01-21 Thread Daniel Dai
Thanks Václav! You are right, I tried on exe file, things works fine on exe, but not bat file. Seems some cleanup is done before we running into main function of exe. So how do we want to fix bat? The rules in my patch seems apply even for exe: 1. if parameter is already quoted, don't quote again

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

2014-01-21 Thread Václav Zeman
On 21 January 2014 01:30, Max Polk wrote: > On 1/20/2014 1:02 AM, 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"

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

2014-01-21 Thread Daniel Dai
Max, Thanks for your reply. Yes, the double quote issue can be reproducible from command line, but not the equal sign. Let's demonstrate the equal sign issue with a C program: #include "unistd.h" int main(int argc, char** argv) { execl("a.bat", "a.bat", "a=b"); return 0; } The intentio

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

2014-01-20 Thread Max Polk
On 1/20/2014 1:02 AM, 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