X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <4B7E94F9.6040602@byu.net> References: <98f79fac1002180955m1ddea014id0b27cc3b909a17a AT mail DOT gmail DOT com> <4B7D80B3 DOT 4000300 AT cygwin DOT com> <98f79fac1002181224g7987690dn6822d025d1a59405 AT mail DOT gmail DOT com> <4B7DA704 DOT 1080709 AT cygwin DOT com> <98f79fac1002190437g5fec3138mb2c7e24d8f03212a AT mail DOT gmail DOT com> <98f79fac1002190452h2d99cf0aqf5ca72d952521da0 AT mail DOT gmail DOT com> <4B7E94F9 DOT 6040602 AT byu DOT net> Date: Fri, 19 Feb 2010 20:12:24 +0100 Message-ID: <98f79fac1002191112p36393cc0qc476c612bf4d9d88@mail.gmail.com> Subject: Re: CreateProcess() - executed program gets different argument depending if it's compiled with gcc (cygwin) or cl (VS)? From: Piotr Krukowiecki To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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: http://cygwin.com/ml/cygwin/2010-02/msg00464.html > 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: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple