delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/08/01/09:43:12

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 571DhBvX3878636
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 571DhBvX3878636
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=jBhuer9I
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C86C3858422
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1754055789;
bh=SuyATtjd4zBFcZuvg//IzRQUqQvVsrYu05P5obizA7M=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=jBhuer9IDtqQIBDRXTJiY5kWVaHU5yOokq/aT13K/oCucBX6rlqHfyK0VSYtQRKj/
EHlyfSdx5k7Su9GNLgv4bDE3etgKVqPrL9EOcGqUq7WWBxt3vcttPwIZ8nR0SjDl56
B7faJACK6KYgGhQ1+qn+yVyWniffUFdcKzYvAGXI=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FCC5385828E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FCC5385828E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1754055760; cv=none;
b=B/WliwiLZw+9mI+r41wIucWDhbEmGVzNbfs2voVxvTtBbYNLPNz0m280XazUnPbPh8lRZdOWETKcPiMJXkzPifgG4rJZseTCVU+hFtPOB+dcJBq0FqVLIlOdoPPfBvzlkyrfJyQ0Brz+pm/TGgE+0sWwwl/pNGmaaPH6zHXGwI0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1754055760; c=relaxed/simple;
bh=l7nlZbqGdns0VXcolnBQRAsEsodFzDf5nNmdrghODkQ=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=lhOQzp6JrrvO9hUXSniCI94oC5kofPVNAMbv8c5oDipD3PrnwrE+FC26avDECf2HT8OzK9Z8ORvvVGon5qTw6+6PeWpjk1kh3TQ3TpxuqEFCLnyj1MuYAvCr8UC9g4GYXCnP2S60VMTOvgq6XBQRx8mB+gaddA3PEqfBlyIJXt8=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FCC5385828E
Date: Fri, 1 Aug 2025 22:42:36 +0900
To: cygwin AT cygwin DOT com
Subject: Re: Incorrect command line handling when launching Cygwin program
from Windows
Message-Id: <20250801224236.d52cdaf32913054e21711a12@nifty.ne.jp>
In-Reply-To: <AS8PR03MB7539A2A8333F01580829C8DB8D27A@AS8PR03MB7539.eurprd03.prod.outlook.com>
References: <AS8PR03MB7539A2A8333F01580829C8DB8D27A AT AS8PR03MB7539 DOT eurprd03 DOT prod DOT outlook DOT com>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
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: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
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>

On Thu, 31 Jul 2025 13:28:14 +0000
"Old, Oliver via Cygwin" <cygwin AT cygwin DOT com> wrote:
> Hello!
> 
> I have recently noticed that the Windows command line parsing routine of Cygwin programs does not
> work correctly when an escaped quotation mark is included. This is relevant when launching a Cygwin-
> based GCC through Windows CMake-generated Ninja files. We are passing preprocessor definitions
> containing quotation marks to GCC and CMake wants to pass them backslash-escaped, but unquoted, on
> the command line.
> 
> A test program I have written to inspect this issue:
> 
> #include <stdio.h>
> int main(int argc, char** argv) {
>   for (int i = 0; i < argc; ++i) puts(argv[i]);
> }
> 
> Running it (via cmd.exe):
> 
> >echo.exe a b\"c\" d
> echo
> a
> b\c" d
> 
> The first escape sequence is ignored, but the quote is read and causes the parser to switch to
> quoted argument mode where it recognizes the remaining escaped quotes as it already should have done
> in regular parsing mode. It then proceeds to eat the remaining command line as there aren't any
> unescaped quotation marks, usually leading GCC to complain about no input files being given.
> 
> Running the Windows-native version of the program:
> 
> >echo-win32.exe a b\"c\" d
> echo-win32.exe
> a
> b"c"
> d
> 
> This should be the expected output. Is the way the escaped quotation mark is treated intended
> behavior? I cannot really see how it would be, given that the parser is only used for command lines
> stemming from being launched by Windows-native programs.

>echo-win32.exe C:\"Program Files"\
echo-win32.exe
C:"Program
Files\

Is this as you expected?

>echo.exe C:\"Program Files"\
echo
C:\Program Files\

This makes more sense to me.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

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

- Raw text -


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