delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/05/09/11:20:15

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=Sk9ITY9Ml6NerZKS/C+5jp8MapECX
bE+r+3+VSWRgck0WOIf6ExTXY17wheysZJXD98VGwRPOto5hW95ytTfUVmGy/ICT
QRq70LAz803bWQhbWbTksD2WKiSQIXExRl0KI7HRbUEA1IFWXhH03pwaDONHo7cQ
Op1aV1/VWaYAqc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=SUKdcNA8Af3698ixm/oAuHZerCA=; b=b5X
FebUwkvHcSjvYWr3BCrQ1nAXRpbI/Poi60rm8YxJja3RSNO47+W/57ERaNkKwXyP
9TX6DoAMLNM2Qgaff7Z11a1VXMNhi4DGHi/YW0UmbRPv5XImcdanL167FZ9wMyv7
INJ27fGvwZGCe+/P6FudIaKxcrYwNkjxCYJcasaU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=BAYES_50,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:FAIL, imho, IMHO, H*F:U*david
X-HELO: outmail149095.authsmtp.com
From: David Allsopp <david AT allsopps DOT net>
To: Aaron Digulla <digulla AT hepe DOT com>, "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: Formatting command line arguments when starting a Cygwin process from a native process
Date: Mon, 9 May 2016 15:19:42 +0000
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9F04BD207@Remus.metastack.local>
References: <006301d1a834$6ccd1380$46673a80$@cantab.net> <5ba8-5730a580-3b-2319ce00 AT 26574710>
In-Reply-To: <5ba8-5730a580-3b-2319ce00@26574710>
MIME-Version: 1.0
X-Server-Quench: 75b5a25f-15f9-11e6-829e-00151795d556
X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse
X-AuthRoute: OCd1ZAARAlZZRRob BgsNCCtbTh09PVtK DAMVKBZePFsRUQkR aAdMdgsUFVQNAgsB AmAbWlJeUVR7XWc7 aQtScwRdZ1RMXgd0 UUlNXVBXCwQmRBgI cGRHI2BycQBCen8+ bUVqWD5cWRZ/JER4 FFNVEDsPeGZhPWYC WEJRIh5UcAJPfxhM bwR6UXVDAxANdgw/ BQo6IywwOzoXIyNQ RwgLIRoWQEAGVjcm SA0HEDMzBgUaRyg1 Zwc6I0QAHUAeekx6 GkouRlMeUVdaEhdZ FExWG2dXPV4EDyNj CwpGXFATWCVHRixR GQZA
X-Authentic-SMTP: 61633634383431.1037:706
X-AuthFastPath: 0 (Was 255)
X-AuthSMTP-Origin: 213.105.212.114/25
X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system.
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id u49FKA58024313

Aaron Digulla wrote:
> 
> Am Samstag, 07. Mai 2016 09:45 CEST, "David Allsopp" <dra27 AT cantab DOT net>
> schrieb:
> 
> 
> > > Then all you need is a rudimentary quoting.
> >
> > Yes, but the question still remains what that rudimentary quoting is -
> i.e.
> > I can see how to quote spaces which appear in elements of argv, but I
> > cannot see how to quote double quotes!
> 
> This should help:
> https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/e
> veryone-quotes-command-line-arguments-the-wrong-way/

This provides documentation for how Microsoft implementations do it, not how Cygwin does it. The Cygwin DLL is responsible for determining how a Cygwin process gets argc and argv from GetCommandLineW.

> My line of thought is that Cygwin can't get anything which Windows can't
> send it. So the first step to solve this mess is to make sure the
> arguments which you send to CreateProcess() are correct.
> 
> The next step would be to write a small C utility which dumps it's
> arguments, so you can properly debug all kinds of characters.

See later email, but IMHO the conversion is something Cygwin should have precisely documented, not determined by brittle experimentation.

> PS: I always point people to string list/array type methods to create
> processes which fix all the problems with spaces and odd characters
> (quotes, umlauts, etc). It seems that Windows doesn't have such a method
> to create processes. Which kind of makes sense; Windows is very, very
> mouse centered.

I fail to see the connection with mice! What Windows (NT) does have is a legacy where the decision on how to convert a command line to a list/array of arguments is determined per-process (and so not the responsibility of command line shells) vs Unix which puts the burden of converting a single command line to the array on the shell instead. Nominally, the Windows way is more flexible, though I don't think that flexibility is actually useful (especially if you look at the comments in the command line -> argv conversion in Microsoft's C Runtime library!). 


David


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019