X-Recipient: archive-cygwin@delorie.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:reply-to:to:subject:date:message-id
	:references:in-reply-to:content-type:content-transfer-encoding
	:mime-version; q=dns; s=default; b=gpevWPTIpyuqibqGyZC/+u8SUUu72
	5qiXR3MfvnGOkxPrGSR0wuNBHROIyaQoDzLafNczzqojajrsOr3vkmIFRXlLsmKN
	xszYwLoeN3GXnLOVxqNDV3E8y/TvKNF7EDUktoigHN5ZqbbvUmzDNV9XQBRZD6g4
	NV/+IX8wQc7OWE=
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:reply-to:to:subject:date:message-id
	:references:in-reply-to:content-type:content-transfer-encoding
	:mime-version; s=default; bh=wcJ7AYI4HD4NW/mvBv/znaWfvqE=; b=gVy
	fXYlEAexABUqR1aCI/Gvn94fGG8SvPC04OylNry0DyOSoJA0ck+BivGME6Zzv+FM
	xPDSPqc7k7i/FtpgXvMaeKGWcwlfs4XV05KrYuaL0Nn/DQYT12OBEcSSnL9xuu71
	hriQFcue1/6BhfOLVMCDNnzoGUjTsQF40E1E9rjo=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no version=3.3.1 spammy=study, inherit, HX-Languages-Length:1348, reproduction
X-HELO: NAM02-SN1-obe.outbound.protection.outlook.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kjgys8Xvh6j0XgYFPYnfLho12VGCoa1YCRBKyRerO8so+fYyFN268dkkuftoshwNgoJFYX97DnP1KuJcF7JJs0w/ogq3O3zzTwm0ZYPMmx79OcoJJAiOKmvGkyyEIwjZcZ4yksnH29lSWKly9StVphcqrSeGPJCWADgW8PkFu5uP7lv0h4MVIRQpIpUCp+CUTUGDYFjuo/mu53QaUr1sP8TF+mPbis0KTCe6/3Y5QuxekZeCNQIU6yWq7d+ICwhO6W7i9gPLDYM1BwVGKrzUjd8/m/4bt+DhfhIqiawIqjpXETw2/FhY++ONNloV5fF7p9jlXJZ+i5WCMbMU3AA9ZQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4ZTH+/PHwyH1GPlq9EsuWI3m/q3Bww0laIn/CGxrxl4=; b=DsDAMPw29FCFsNdY840s5cYk5G0Ha4arLU1QPUJMdUu98m0VYzBKESnP+yc9sTrBPCXWkTHsjH6jPoJ6Hz3/BhIeRKqa9sW6EBV1QQlhLYcGcHjdp0c9QVFs5Ltxfk7z2jKiRvuU+g1/oEzZz5u7gOyh7wAschBelF8AcFPY8R9A1cKeoc19EaamqWzgu+taPoom8KlXdY52xWldYlM/JJ6bjdzUHJFIJ9TsgrjY+JJG6bCM9wLftLwoYTD1IArB25pD7/5oCFQa6Ga7xxnvn64q9qqBi3rtB9DYe23Fd0y2TypWbpgmxh0dAwqy2LRnMwSkO5Cu7OzSTeQ1dItxqw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4ZTH+/PHwyH1GPlq9EsuWI3m/q3Bww0laIn/CGxrxl4=; b=XUKwEMK5NE+GalBp7TT+3B02Dsbrh3g/FqsG/CGS9/JlzOmLCsyjakHzsXEpuculXFfHhpGpNVPV87F3+lKRO+LCD6FnJDWY8tM6LCL5hA3m1NpZM+ywxf8W/ah14qco3L7N5H4elTiQtp5eI+D5ixw2U1Y23elQZNMGPpasnbs=
From: "Stephen Provine via cygwin" <cygwin@cygwin.com>
Reply-To: Stephen Provine <stephpr@microsoft.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>,
        "Brian.Inglis@SystematicSw.ab.ca"	<Brian.Inglis@SystematicSw.ab.ca>
Subject: RE: Command line processing in dcrt0.cc does not match Microsoft parsing rules
Date: Wed, 4 Sep 2019 23:46:17 +0000
Message-ID: <MWHPR21MB08456D9F03AF8BD450E6AB2EB9B80@MWHPR21MB0845.namprd21.prod.outlook.com>
References: <MWHPR21MB08452919F35B1B0C5F0EB4DCB9BD0@MWHPR21MB0845.namprd21.prod.outlook.com> <MWHPR21MB0845F78385792965A94E0CD9B9BD0@MWHPR21MB0845.namprd21.prod.outlook.com> <MWHPR21MB084508155AB621C7AD81309CB9B90@MWHPR21MB0845.namprd21.prod.outlook.com>
In-Reply-To: <MWHPR21MB084508155AB621C7AD81309CB9B90@MWHPR21MB0845.namprd21.prod.outlook.com>
authentication-results: spf=none (sender IP is ) smtp.mailfrom=stephpr@microsoft.com;
x-ms-oob-tlc-oobclassifiers: OLM:5516;
received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: b6l6uHTLLrFWFx8PP3N4VACl5dbaw4uTfGVGmkZuVugklqLJB5DIYl0qu9ybYvu8Q4/mg/skGjm0VBSUo6DgYw==
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x84NkuoY005129

On 2019-09-04 10:20, Brian Inglis wrote:
> and ask if you really expect anyone else to use or reproduce this insanity,
> rather than a sane POSIX parser?

I know it's insanity, but it's insanity that almost all Windows programs inherit and
implement consistently enough because they use standard libraries or functions
to do the parsing. The Go command line parser used to use CommandLineToArgvW
and only switched away from it due to performance (it's in shell32.dll and that takes
a long time to load). I don't know how accurate their manual reproduction is, but
they seemed to study the sources I sent pretty carefully.

Anyway, my specific problem is that I have Go code with an array of arguments that
I want to pass verbatim (no glob expansion) to a bash script. I've figured out how to
override Go's default code for building the command line string, but it's not clear how
to correctly construct the command line string. If the POSIX rules are being followed,
I'd expect the following to work:

    bash.exe script.sh arg1 "*" arg3

But it always expands the "*" to all the files in the current directory. I've also tried \* and
'*', but same problem. So how do I build a command line string that takes each argument
literally with no processing?

Thanks,
Stephen


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


