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: CreateProcess() - executed program gets different argument depending if it's compiled with gcc (cygwin) or cl (VS)?

On Fri, Feb 19, 2010 at 2:41 PM, Eric Blake wrote:
> I haven't followed your queries closely (since you keep replying to
> yourself).  But it all boils down to:

See here for the introduction to the problem:

> what shell are you using, with its particular quoting rules

I'm not using any - I'm creating processes using CreateProcess() with
command line created on the fly passed - I believe shell (cmd.exe,
bash, etc) quoting rules you described do not apply in this case.

> For a windows process invoking a cygwin process, windows rules are
> followed (the shell doesn't strip anything, but calls CreateProcess
> as-is); but then the cygwin1.dll strips the quoting before main()
> according to windows rules so that the cygwin process sees the resulting
> arguments without quotes.  This way, cygwin apps themselves NEVER have to
> worry about quoting, regardless of who the parent process was.
> For a windows process invoking a windows process, windows rules are
> followed (roughly: cmd.exe passes everything, quotes and all, into
> CreateProcess, and the child app is responsible for stripping them).
> But nowhere in this do I see any way that the compiler used could affect
> how quoting is handled.

The problem is that the command line passed to CreateProcess() is the
same if I invoke the windows and the cygwin process (I don't know what
kind of process that is), but in the case of cygwin process
cygwin1.dll, as you wrote, strips quotes (and what is more important
backslashes inside the quotes) and so the result is different.

Please correct me if I'm missing something.

Piotr Krukowiecki

Problem reports:
Unsubscribe info:

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