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:message-id:subject:from:to:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; q=dns; s=default; b=ISByDj01+I0fQeZzEsZxmUFeyJlnWfdrY1oMk77VhhG 16nXlJcRGqCWB5+Xg3PX09fOQholTUhtqy44VXZMZScYyXik3FC7l2vKVYzc/mRi mM9Zj74hq+rNtbEZongHsd6l2LyxPRg2TSNFDP8N6hN7k95x1yvOoe/nRrfP3lt0 = 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:message-id:subject:from:to:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; s=default; bh=LBXI7m9PY+P/vTmXFz++ff9zNqY=; b=uvtOZZitP3TpegMDi k3STSF6ISZfOE4egCMMyDYigSdCo4mrqfmNE5P5dMFMUPC5wCsl/2uV4Tmkh+I+W RLyRs+jlY5KgTZHI3LKoVqpVn+tr5UVSarl/lreEZw8amWTtisAmKdjJ8+un4sYz G86f5fGEefdMNZ6CU714b1U7LQ= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:Sat, H*Ad:D*t-online.de, HContent-Transfer-Encoding:8bit X-HELO: mail-wr1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=NXViYgE7fJJXQ98tnnb7fZ+OQ1p40ISIg6TTIa9grjc=; b=e1XID2JcwQsYtLhbnI1qUu1/6Rf2bfce02TFd85qA3kuzpC2s8PZ1VIOmtnZ062+LJ 34G4gAthJsYe72A1JaH/PdX9BYK1IRs4DebLwFsGeYXCXAkf2pxNq3Q+tESzeN7pydN6 SOV0trzbTu+0Hghd8cqFOsP+n/Y4MfWJXFBTOChfRzbDJXMCQ0qFww4+np9RJ6UP15qP /l17o3/ORSpD8fWG+pj1QLPJ1MOW1WaS9FCLD23iZZ5URmw87cjW6RX63Og04jJQpcmM azJc0t0HeAf3WG01C65WYaN3IBbbgLveYAFvdboXA9Bs/yJ5TXlnk6He/pcMKXFpKW2+ VZCQ== Message-ID: <362ba7f25b43ecfca396e21e26def8315cb22c40.camel@gmail.com> Subject: Re: Process argument passing problems From: reiter DOT christoph AT gmail DOT com To: Hans-Bernhard =?ISO-8859-1?Q?Br=F6ker?= , cygwin AT cygwin DOT com Date: Sat, 22 Jun 2019 09:09:31 +0200 In-Reply-To: <13855b6c-f65e-b07f-3f6f-4ffd5cb945a6@t-online.de> References: <5be40c24ed860fb56dc28523f464cadd5068c268 DOT camel AT gmail DOT com> <13855b6c-f65e-b07f-3f6f-4ffd5cb945a6 AT t-online DOT de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes On Fri, 2019-06-21 at 22:15 +0200, Hans-Bernhard Bröker wrote: > Am 21.06.2019 um 17:19 schrieb reiter DOT christoph AT gmail DOT com: > > Hey everyone, > > > > I have to following problem (using cmd.exe): > > > > C:\cygwin64\home\xy>C:\cygwin64\bin\echo.exe -DFOO=\"BAR\" -DBAR=\"FOO\" > > -DFOO=\BAR" -DBAR="FOO" > > > > I would have expected: > > > > -DFOO="BAR" -DBAR="FOO" > > Expecting cmd.exe to parse command lines in anything resembling a sane > way is, unfortunately, an exercise in futility. > > Microsoft allowed blanks in filenames with hardly any regard for the > concepts of command lines and their parsing. We're still fighting with > the repercussions now, 25 years later. I'm actually using ProcessCreate() and calling cygwin gcc. The echo.exe example seemed to show the exact same problem which is why I thought it might be easier to reproduce for others. > > Context: I'm executing various cygwin programs through (native) Python and > > passing C macros to gcc like 'gcc -DFOO=\"BAR\"' fails because of this. > > Are you sure Python even goes through cmd.exe to pass those command > lines? If it doesn't, figuring out what cmd.exe does may be even less > fruitful than it already is. Not, it doesn't use cmd.exe. It uses subprocess.list2cmdline to convert the argument list to something suitable for ProcessCreate() and then calls ProcessCreate. >>> subprocess.list2cmdline(['-DFOO="BAR"']) '-DFOO=\\"BAR\\"' ... > > More background: https://github.com/msys2/MINGW-packages/issues/3548 > > Please note that that's about MSYS2, which, while closely related to > Cygwin, is not really the topic of this mailing list. Feel free to ignore it if doesn't help. The bug shows how I came to the conclusion that it might be a cygwin bug, which made me post here. Thanks! -- 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