delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/09/07/08:21:07

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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=LsCjQLm6FiQbsaq3
qPq8gl8RW7eZE30+s2HDfLZSX72SUDhuWDh1shqPyf1/PjJ8O+fKi1Autr6Mbjth
WvFO2ZzhjG/nzQq9UcvXU1qGNqd0e3M6j8lonveIqhBXbjPgyTNYGwdPRsDJv0M0
xc28DuHCCPUty8ETZHXNQmniqjI=
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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=AuaL03S53IYgd52syq3Ps8
crfx0=; b=ExCueea1rtlzX8N+EuSWyp6aOanezbHXvlr9qBP36H74Qvl75LwAGy
1oHV1n3wkgk6f8SG1Ipo/Je3rKut/aK5O2ZvnBXZo1QnD4NQuGnP8Hc4c/EUt0ka
6lnNqTMHjhfNViknFUExa6Z5ueGX2gDmqBf3WwYNoQ7St3EoXUzmI=
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=0.3 required=5.0 tests=BAYES_00,DATE_IN_PAST_12_24,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.1 spammy=H*M:yandex, H*F:D*yandex.ru, UD:yandex.ru, H*i:sk:MWHPR21
X-HELO: forward101o.mail.yandex.net
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1567858806; bh=8kvFDTE0rThDjb353GdgR3XTP6RJ2fZnBg+1S+JAmk8=; h=In-Reply-To:Subject:To:Reply-To:From:Message-ID:References:Date; b=SPMGkKUOs2E8sPOnUhIRWuVsweC84vHAT5wfIyYE9HTxa4i+30IkU5mBNYc6QVaZY SIQgrzk0VQGZA+1yqbfURNJlVYFlUHTfu7RyphZuuZEQW8UN1vyQNwBbmSwC0qzMB8 WAyrD9NNQklefOte8gWuA9vhZzBqpOHLHJETCgK0=
Authentication-Results: mxback1g.mail.yandex.net; dkim=pass header.i=@yandex.ru
Date: Fri, 6 Sep 2019 23:34:45 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <135817606.20190906233445@yandex.ru>
To: Stephen Provine <stephpr AT microsoft DOT com>, cygwin AT cygwin DOT com
Subject: Re: Command line processing in dcrt0.cc does not match Microsoft parsing rules
In-Reply-To: <MWHPR21MB0845282E7582DC95ADF0F140B9BB0@MWHPR21MB0845.namprd21.prod.outlook.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>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Stephen Provine!

> On 2019-09-04 23:29, Brian Inglis wrote:
>> As standard on Unix systems, just add another level of quoting for each level of
>> interpretation, as bash will process that command line, then bash will process
>> the script command line.

> My mistake - I'm very aware of the quoting rules, yet in my test script for this
> scenario I forgot to quote the arguments. However, if POSIX rules are being
> implemented, there is still something I didn't expect. Here's my bash script:

> #!/bin/bash
> echo "$1"
> echo "$2" 
> echo "$3"

> And I invoke it like this from a Windows command prompt:

> C:\> bash -x script.sh foo bar\"baz bat
> + echo foo
> foo
> + echo 'bar\baz bat'
> bar\baz bat
> + echo ''

> Not expected. Called from within Cygwin, the behavior is correct:

Again, fully expected.

> $ bash -x script.sh foo bar\"baz bat
> + echo foo
> foo
> + echo 'bar"baz'
> bar"baz
> + echo bat
> bat

> Can you explain this difference?

CMD escape character is ^, not \

> The reason I ask is that if this worked,
> the way Go constructs the command line string would be just fine.

No.


-- 
With best regards,
Andrey Repin
Friday, September 6, 2019 23:33:46

Sorry for my terrible english...


--
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

- Raw text -


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