From: reiter.christoph@gmail.com
To: "Hans-Bernhard Bröker" <HBBroeker@t-online.de>, cygwin@cygwin.com
Subject: Re: Process argument passing problems
Date: Sat, 22 Jun 2019 07:09:00 -0000 [thread overview]
Message-ID: <362ba7f25b43ecfca396e21e26def8315cb22c40.camel@gmail.com> (raw)
In-Reply-To: <13855b6c-f65e-b07f-3f6f-4ffd5cb945a6@t-online.de>
On Fri, 2019-06-21 at 22:15 +0200, Hans-Bernhard Bröker wrote:
> Am 21.06.2019 um 17:19 schrieb reiter.christoph@gmail.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
next prev parent reply other threads:[~2019-06-22 7:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 15:19 reiter.christoph
2019-06-21 20:15 ` Hans-Bernhard Bröker
2019-06-21 21:13 ` Brian Inglis
2019-06-22 7:15 ` reiter.christoph
2019-06-22 7:09 ` reiter.christoph [this message]
2019-06-22 8:41 ` reiter.christoph
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=362ba7f25b43ecfca396e21e26def8315cb22c40.camel@gmail.com \
--to=reiter.christoph@gmail.com \
--cc=HBBroeker@t-online.de \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).