This is the mail archive of the cygwin 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: compiling C w/cygwin vs. -mno-cygwin; inconsistent "C" behavior

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
runtime (MinGW)".

For what it's worth the MinGW project has a set of exec() wrappers that
help to sanitize the situation a little.


Unsubscribe info:
Problem reports:

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