delorie.com/archives/browse.cgi | search |
DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 574BpDcJ1529188 |
Authentication-Results: | delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com |
Authentication-Results: | delorie.com; spf=pass smtp.mailfrom=cygwin.com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 delorie.com 574BpDcJ1529188 |
Authentication-Results: | delorie.com; |
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=f0kbmEum | |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 3D539385840E |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1754308271; | |
bh=vCvZpGQoX3s8Yqknwh+8K2GEho7KCXdaU6/I+mwVePA=; | |
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=f0kbmEumAcpzBlHSs4g7eP0ipboJ6D1O8Ggs9FM5nel9jc1Zs5B6IvKkvyPkMeoyJ | |
ekLdDKeS8QnCm1bkKvl7iRL9ARmmwE69us+1IoxG0TYaXrED0BpIwYm3tRtyFyMqoE | |
RAFo9hH8uDEqtGKjo1/0gCza71U3do/M5v84sd9A= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 05B763858D29 |
ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org 05B763858D29 |
ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1754308204; cv=none; |
b=YdlN415XlvkyOs1X3YKKuzgQ5vAUCsvwttX5gIx6B3dc5hCveNmuBJN5nMyTfOre9aa1nrsCkZ/uErCdJBAMK7gsVW/iY7bbf6Qc91GtOvKd8EHQBbfzgHJhBhmbq3fhhwkq5sM5PcF31PhXA+9rnm92jAMSUmHnIgjYaHof7Fw= | |
ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
t=1754308204; c=relaxed/simple; | |
bh=G6T4BiSZI+App9zfuBAfb2Wcq+vbmrS9wmAr6wfnxPI=; | |
h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version; | |
b=nNzgZ9tTJu+GId8FSI17+cPowT09h2rxo9XQPZw/w41qlLlEcHJIKdn4FLse13s2e6ei/m3Lt6pT3kPlhyeOdYfKHvwTq9EK8/pEZeJSHcfx0Hlc1gh0odorwZ0LU5+INAJvnDJTnP3AXCDL2kAjPbmBI8RIJt65lzxFMPUBshQ= | |
ARC-Authentication-Results: | i=1; server2.sourceware.org |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 05B763858D29 |
X-Yandex-Fwd: | 1 |
Date: | Mon, 4 Aug 2025 14:41:27 +0300 |
X-Mailer: | The Bat! (v9.3.4) Professional |
Message-ID: | <577162836.20250804144127@yandex.ru> |
To: | Jeremy Drake <cygwin AT jdrake DOT com>, cygwin AT cygwin DOT com |
Subject: | Re: Incorrect command line handling when launching Cygwin program |
from Windows | |
In-Reply-To: | <cb1a1c52-9c7d-8fbb-e724-a22fa9acc1a2@jdrake.com> |
References: | <AS8PR03MB7539A2A8333F01580829C8DB8D27A AT AS8PR03MB7539 DOT eurprd03 DOT prod DOT outlook DOT com> |
<20250801224236 DOT d52cdaf32913054e21711a12 AT nifty DOT ne DOT jp> | |
<AS8PR03MB7539945DA4EFCF7604405E378D26A AT AS8PR03MB7539 DOT eurprd03 DOT prod DOT outlook DOT com> | |
<20250802140151 DOT 674d96f806911c2db06c88cb AT nifty DOT ne DOT jp> | |
<cb1a1c52-9c7d-8fbb-e724-a22fa9acc1a2 AT jdrake DOT com> | |
MIME-Version: | 1.0 |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.30 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Andrey Repin via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | cygwin AT cygwin DOT com |
Cc: | Andrey Repin <anrdaemon AT yandex DOT ru> |
Errors-To: | cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com> |
Greetings, Jeremy Drake! >> cygwin does not treat \ as a quote if it is passed from non-cygwin shell. >> When a Cygwin program is launched from a non-Cygwin shell, I personally >> find it more natural for it to follow quoting semantics similar to Bash. >> >> I'm afraid that's not the case... >> >> > It sadly breaks builds driven by Windows-native tools since they expect >> > the standard command line handling. > What standard command line handling is that? As a background, on Windows > command lines are passed to processes as a single string, rather than as > an array of strings like POSIX, and it is the responsibility of every > process to make of that string what they will. Because of the prevalance > of C, this is ususally to split it into an argv[], but it doesn't have to > be. > The net result of this is that you not only have to worry about the > quoting and escaping rules of your shell (do you escape with backslash? > caret? backtick?), you also have to worry about the rules of the program > being run (cmd.exe with or without /S, Cygwin vs Microsoft CRT). > There is something of a de-facto "standard command line handling" which is > "what msvcrt does to populate argv[] before calling main", but that's not > foolproof either: reference a recent bruhaha about a "worst-fit" > vulnerability. It seems the crt will use best-fit and default replacement > characters when converting the command line string from the native 2-byte > unicode to the ansi codepage for char ** argv. That can result in unicode > quote characters turning into ascii quotes, and in unmappable unicode > characters turning into question marks, which then might end up treated as > wildcards by the application. You're mixing the Win32 API execution parameters handling and CMD command line parsing into one question. They are not the same, not directly related even. Much like bash, CMD (and PS too) have their own rules to build params from command line. -- With best regards, Andrey Repin Monday, August 4, 2025 14:37:23 Sorry for my terrible english... -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |