Re: cygwin programs called from non-cygwin programs mauling \ in args
On Thu, Jan 20, 2005 at 10:26:13AM +0100, Corinna Vinschen wrote: Yitzchak, On Jan 19 15:34, Yitzchak Scott-Thoennes wrote: $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? I can. I already had a look into this. The command line handling in Cygwin is different from the command line handling in MingW or, FWIW, VC++ CLI applications. The question is if we really should align the rules how a native command line is evaluated by a Cygwin process should be aligned to Windows rules or not. There are three arguments to consider: - Using Windows/MingW rules lowers the surprise. - Changing the rules at all breaks backward compatibility. - Why shouldn't Cygwin applications use their own rules which seem more appropriate for a POSIX application? Corinna, have you a chance to think about this? I've come to think that using the MinGW rules makes most sense. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
On Apr 6 02:09, Yitzchak Scott-Thoennes wrote: Corinna, have you a chance to think about this? I've come to think that using the MinGW rules makes most sense. I didn't think any further about this. It's not that important since it's easily workaroundable. I also fear we get the usual complaints that zillions of scripts must be changed if we dare to break backward compatibility here. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin@cygwin.com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
On Wed, Jan 19, 2005 at 09:08:13PM -0600, Gary R. Van Sickle wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yitzchak Scott-Thoennes Sent: Wednesday, January 19, 2005 5:34 PM To: cygwin@cygwin.com Subject: Re: cygwin programs called from non-cygwin programs mauling \ in args On Wed, Jan 12, 2005 at 10:42:48PM -0800, Yitzchak Scott-Thoennes wrote: $ cat child.c #include stdio.h int main(int argc, char **argv) { printf([%s]\n, argv[1]); return 0; } $ cat parent.c #include unistd.h int main(int argc, char **argv) { char *args[] = { argv[1], a\\\b\\\c, 0}; execv( argv[1], args); return 1; } $ gcc -mno-cygwin -Wall parent.c -o nocygparent parent.c: In function `main': parent.c:4: warning: passing arg 2 of `execv' from incompatible pointer type $ gcc -Wall child.c -o cygchild $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? Lessee ...sorta. I get: $ ./nocygparent cygchild ~ $ [a\bc] And then it sits there waiting for input. When I hit enter it quits and brings me back to the prompt. This is with snapshot 20050116 and gcc (GCC) 3.4.1 (cygming special). What happens if you correct the warning? The error is the fault of the mingw headers being incorrect for exec*, but makes no difference. (SuSv3 whines at length about why the headers need to be as they should be.) See the $ before the [ there? That's a shell prompt. The program already ended, but the output is a little scrambled (which seems to happen a lot when there are child processes of late). Not related to the problem I'm describing. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
Yitzchak, On Jan 19 15:34, Yitzchak Scott-Thoennes wrote: $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? I can. I already had a look into this. The command line handling in Cygwin is different from the command line handling in MingW or, FWIW, VC++ CLI applications. The question is if we really should align the rules how a native command line is evaluated by a Cygwin process should be aligned to Windows rules or not. There are three arguments to consider: - Using Windows/MingW rules lowers the surprise. - Changing the rules at all breaks backward compatibility. - Why shouldn't Cygwin applications use their own rules which seem more appropriate for a POSIX application? Btw., if you want the same result as for the noncygchild, just quote: $ cygchild a\b\c Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin@cygwin.com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
On Thu, Jan 20, 2005 at 10:26:13AM +0100, Corinna Vinschen wrote: Yitzchak, On Jan 19 15:34, Yitzchak Scott-Thoennes wrote: $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? I can. I already had a look into this. Wonderful! Thanks a lot! The command line handling in Cygwin is different from the command line handling in MingW or, FWIW, VC++ CLI applications. The question is if we really should align the rules how a native command line is evaluated by a Cygwin process should be aligned to Windows rules or not. I'd be happy with \ coming out either as or as \. But just \ is just a little too weird for me (aside from the trouble it's causing me). There are three arguments to consider: - Using Windows/MingW rules lowers the surprise. - Changing the rules at all breaks backward compatibility. - Why shouldn't Cygwin applications use their own rules which seem more appropriate for a POSIX application? Btw., if you want the same result as for the noncygchild, just quote: $ cygchild a\b\c That's what I'm doing for now with a local patch, but the upstream code in question has to run under many different operating systems, and I'm reluctant to suggest changing it. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
On Jan 20 01:41, Yitzchak Scott-Thoennes wrote: On Thu, Jan 20, 2005 at 10:26:13AM +0100, Corinna Vinschen wrote: Yitzchak, On Jan 19 15:34, Yitzchak Scott-Thoennes wrote: $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? I can. I already had a look into this. Wonderful! Thanks a lot! The command line handling in Cygwin is different from the command line handling in MingW or, FWIW, VC++ CLI applications. The question is if we really should align the rules how a native command line is evaluated by a Cygwin process should be aligned to Windows rules or not. I'd be happy with \ coming out either as or as \. But just \ is just a little too weird for me (aside from the trouble it's causing me). Ok, just to explain what happens right now: The evaluation algorithm allows two different types of quoting, using single (') or double () quotes. Backslashes are not treated as escape characters outside of quotes. So what happens is that the first backslash is treated as backslash (path separator from the native perspective, then a double quote quoting starts, the next backslash is treated as escape for the following double quote, only leaving the double quote. Since there's no further double quote, the quoting stops at the end of the string. Compared with Windows native rules: The evaluation algorithm allows only double quotes as quoting character. Backslashes only escape quotes. Any number of backslashes is treated literally, unless followed by a double quote. In that case, each pair of backslashes is treated as one backslash and a remaining \ is treated as escaped double quote character. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin@cygwin.com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
On Wed, Jan 12, 2005 at 10:42:48PM -0800, Yitzchak Scott-Thoennes wrote: $ cat child.c #include stdio.h int main(int argc, char **argv) { printf([%s]\n, argv[1]); return 0; } $ cat parent.c #include unistd.h int main(int argc, char **argv) { char *args[] = { argv[1], a\\\b\\\c, 0}; execv( argv[1], args); return 1; } $ gcc -mno-cygwin -Wall parent.c -o nocygparent parent.c: In function `main': parent.c:4: warning: passing arg 2 of `execv' from incompatible pointer type $ gcc -Wall child.c -o cygchild $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: cygwin programs called from non-cygwin programs mauling \ in args
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yitzchak Scott-Thoennes Sent: Wednesday, January 19, 2005 5:34 PM To: cygwin@cygwin.com Subject: Re: cygwin programs called from non-cygwin programs mauling \ in args On Wed, Jan 12, 2005 at 10:42:48PM -0800, Yitzchak Scott-Thoennes wrote: $ cat child.c #include stdio.h int main(int argc, char **argv) { printf([%s]\n, argv[1]); return 0; } $ cat parent.c #include unistd.h int main(int argc, char **argv) { char *args[] = { argv[1], a\\\b\\\c, 0}; execv( argv[1], args); return 1; } $ gcc -mno-cygwin -Wall parent.c -o nocygparent parent.c: In function `main': parent.c:4: warning: passing arg 2 of `execv' from incompatible pointer type $ gcc -Wall child.c -o cygchild $ ./nocygparent cygchild [a\bc] Can anybody else confirm this? Lessee ...sorta. I get: $ ./nocygparent cygchild ~ $ [a\bc] And then it sits there waiting for input. When I hit enter it quits and brings me back to the prompt. This is with snapshot 20050116 and gcc (GCC) 3.4.1 (cygming special). What happens if you correct the warning? -- Gary R. Van Sickle -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: cygwin programs called from non-cygwin programs mauling \ in args
On Wed, Jan 12, 2005 at 10:42:48PM -0800, Yitzchak Scott-Thoennes wrote: Given a simple child process that prints its argument, and a parent that execs it passing a\b\c, trying combinations of cygwin and non- cygwin parent and child shows inconsistency in what's received: $ cat child.c #include stdio.h int main(int argc, char **argv) { printf([%s]\n, argv[1]); return 0; } $ cat parent.c #include unistd.h int main(int argc, char **argv) { char *args[] = { argv[1], a\\\b\\\c, 0}; execv( argv[1], args); return 1; } $ gcc -mno-cygwin -Wall child.c -o nocygchild $ gcc -mno-cygwin -Wall parent.c -o nocygparent parent.c: In function `main': parent.c:4: warning: passing arg 2 of `execv' from incompatible pointer type Incidentally, that warning is due to mingw having a non-compliant prototype. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
cygwin programs called from non-cygwin programs mauling \ in args
Given a simple child process that prints its argument, and a parent that execs it passing a\b\c, trying combinations of cygwin and non- cygwin parent and child shows inconsistency in what's received: $ cat child.c #include stdio.h int main(int argc, char **argv) { printf([%s]\n, argv[1]); return 0; } $ cat parent.c #include unistd.h int main(int argc, char **argv) { char *args[] = { argv[1], a\\\b\\\c, 0}; execv( argv[1], args); return 1; } $ gcc -mno-cygwin -Wall child.c -o nocygchild $ gcc -mno-cygwin -Wall parent.c -o nocygparent parent.c: In function `main': parent.c:4: warning: passing arg 2 of `execv' from incompatible pointer type $ gcc -Wall child.c -o cygchild $ gcc -Wall parent.c -o cygparent $ ./cygparent cygchild [a\b\c] $ ./cygparent nocygchild [a\b\c] $ ./nocygparent cygchild [a\bc] $ ./nocygparent nocygchild [abc] The a\bc definitely looks like something going wrong. (This is breaking things for me when using gcc from a non-cygwin make program.) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/