delorie.com/archives/browse.cgi | search |
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:subject:to:references:from:message-id:date | |
:mime-version:in-reply-to:content-type; q=dns; s=default; b=FpEF | |
hsIhHU6gq9bhLkOSozoV8TOh8Le/BuAwJTd5FSZl/ost24VuCjnKQVe3p7j7eoVg | |
zCghNWOLR4nULaQZ8Oa+VDpoJPIm+pwt4oVQ9qJOtS8pwh1q5hSxoBJrtnIxNRvm | |
oxIrJsJh6iK4OW5jP00DaR9Nr9pX6rPJlIr8D3E= | |
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:subject:to:references:from:message-id:date | |
:mime-version:in-reply-to:content-type; s=default; bh=lF/XmvniZm | |
EwQVtVcZRcPchSOO4=; b=W19fb8BInzpminMv0NCs1lxXse6k46ItATktepFBnH | |
waGO4/uZwl+/OZmIZ9Y2wEHx4ny2Fa1EklkRdm1G9wvlNLI1kdn0J5mheXCtzrtd | |
cEyaWsKSaCdpjOWwEoX0mXdJxCxxtQw3Mj87XIJZaPbWTCcQN46tnAKLg4Rnpo1B | |
s= | |
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-Spam-SWARE-Status: | No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= |
X-HELO: | mx1.redhat.com |
Subject: | Re: Command line processing in dcrt0.cc does not match Microsoft parsing rules |
To: | cygwin AT cygwin DOT com |
References: | <MWHPR21MB08452919F35B1B0C5F0EB4DCB9BD0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB0845F78385792965A94E0CD9B9BD0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB084508155AB621C7AD81309CB9B90 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB08456D9F03AF8BD450E6AB2EB9B80 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB0845282E7582DC95ADF0F140B9BB0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> |
From: | Eric Blake <eblake AT redhat DOT com> |
Openpgp: | preference=signencrypt |
Message-ID: | <0037aca6-e714-4e0a-53b8-18bbc582662a@redhat.com> |
Date: | Thu, 5 Sep 2019 14:05:09 -0500 |
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
MIME-Version: | 1.0 |
In-Reply-To: | <MWHPR21MB0845282E7582DC95ADF0F140B9BB0@MWHPR21MB0845.namprd21.prod.outlook.com> |
X-IsSubscribed: | yes |
--sgMBXYBU6LPc4auvOftnKbWTWR9u5Vb3K Content-Type: multipart/mixed; boundary="2M2cnD48jIvHJBbGuz9om5TzfDnBUa5Sw"; protected-headers="v1" From: Eric Blake <eblake AT redhat DOT com> To: cygwin AT cygwin DOT com Message-ID: <0037aca6-e714-4e0a-53b8-18bbc582662a AT redhat DOT com> Subject: Re: Command line processing in dcrt0.cc does not match Microsoft parsing rules References: <MWHPR21MB08452919F35B1B0C5F0EB4DCB9BD0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB0845F78385792965A94E0CD9B9BD0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB084508155AB621C7AD81309CB9B90 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB08456D9F03AF8BD450E6AB2EB9B80 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> <MWHPR21MB0845282E7582DC95ADF0F140B9BB0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> In-Reply-To: <MWHPR21MB0845282E7582DC95ADF0F140B9BB0 AT MWHPR21MB0845 DOT namprd21 DOT prod DOT outlook DOT com> --2M2cnD48jIvHJBbGuz9om5TzfDnBUa5Sw Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/5/19 1:31 PM, Stephen Provine via cygwin wrote: > My mistake - I'm very aware of the quoting rules, yet in my test script f= or this > scenario I forgot to quote the arguments. However, if POSIX rules are bei= ng > implemented, there is still something I didn't expect. Here's my bash scr= ipt: >=20 > #!/bin/bash > echo "$1" > echo "$2"=20 > echo "$3" >=20 > And I invoke it like this from a Windows command prompt: >=20 > C:\> bash -x script.sh foo bar\"baz bat > + echo foo > foo > + echo 'bar\baz bat' > bar\baz bat > + echo '' >=20 > Not expected. Why not? That obeyed cmd's odd rules: The moment you have a " in the command line, that argument continues until end of line or the next " (regardless of how many \ precede the "). https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/ev= eryone-quotes-command-line-arguments-the-wrong-way/ Perhaps you meant to try: c:\> bash -x script.sh foo ^"bar\^"baz^" bat > Called from within Cygwin, the behavior is correct: >=20 > $ bash -x script.sh foo bar\"baz bat > + echo foo > foo > + echo 'bar"baz' > bar"baz > + echo bat > bat Moral of the story: POSIX rules are saner than cmd rules. >=20 > Can you explain this difference? The reason I ask is that if this worked, > the way Go constructs the command line string would be just fine. If Go is not constructing the command line string in a manner that matches that blog post, the bug would be in Go. Presumably, Cygwin is correctly quoting things any time it calls into a non-Cygwin process (but if not, give us a test case for us to patch cygwin, or even better submit the patch). --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org --2M2cnD48jIvHJBbGuz9om5TzfDnBUa5Sw-- --sgMBXYBU6LPc4auvOftnKbWTWR9u5Vb3K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl1xXGUACgkQp6FrSiUn Q2qM0Af+Mb9InXvvy2I/oplO65Ih0osN26OCTy+Q8PUzrhlypzqzuzqhiWLnl0O+ 5kkZjYCXkUDi7EBikZUviE3inb+BhE0T5PgtU8fjCyySLbWAWtjjw5N8Mdn/VBmJ xls2LQv1b8EKMjlAxz+82b2ULA//Ch4vE8rVDV6IGygVF7ba5qpjsi1QHGRSPiyT AVhYVPhGiPc4jary4xmZoYJ1epF7iHPUyJzw7AvQ5Hi2Y8mg1HtcNqIKs+wL/DAv qT3SCZPo+tuUCsXMha6N9cZWhHVE4bsz5WMAwQObjoxkYKRkdLhkoAY5g+NUPxcO wcLjyX55o0zbndgG3BqyXwwXMCdA4g== =Zxg+ -----END PGP SIGNATURE----- --sgMBXYBU6LPc4auvOftnKbWTWR9u5Vb3K--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |