This is the mail archive of the
mailing list for the Cygwin project.
Re: compiling C w/cygwin vs. -mno-cygwin; inconsistent "C" behavior
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Sun, 16 Mar 2008 03:22:12 -0700
- Subject: Re: compiling C w/cygwin vs. -mno-cygwin; inconsistent "C" behavior
- References: <47DCE267.firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
Linda Walsh wrote:
> When I use the "no-cygwin" version, filenames with spaces in them get split into
> separate arguments, but if I run the "cygwin" version, the file name isn't split
> on space boundaries.
> I'm 'guessing', but shouldn't the breaking of apart of arguments behave
> the same whether I compile with cygwin or -mno-cygwin?
No, what you're seeing is totally expected behavior. In native windows
if you want to support filenames with spaces, you have to include
physical quote characters in the command line. That's because
CreateProcess does not actually have an argv, there is no such thing as
an argv in windows -- a process gets created with a monolithic command
line. If it wants that command line in the form of individual
arguments, it has to parse it (or ask the system/CRT to parse it for
it.) That means that the only way to make arguments with spaces survive
intact is by quoting.
And Cygwin does that quoting for you. The native runtime MSVCRT does
not, which is what is executing when you're using -mno-cygwin. If you
don't like its behavior then take it up with Microsoft, it's out of our
hands. There is no guarantee of consistency whatsoever, because
-mno-cygwin literally means "don't use any Cygwin, use the Microsoft
For what it's worth the MinGW project has a set of exec() wrappers that
help to sanitize the situation a little.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html