public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: Command line processing in dcrt0.cc does not match Microsoft parsing rules
Date: Wed, 04 Sep 2019 16:20:00 -0000	[thread overview]
Message-ID: <f5a94050-695c-d3e9-594b-a8f9972266ac@SystematicSw.ab.ca> (raw)
In-Reply-To: <MWHPR21MB084508155AB621C7AD81309CB9B90@MWHPR21MB0845.namprd21.prod.outlook.com>

On 2019-09-03 10:38, Stephen Provine wrote:
> On 2019-08-30 21:58, Brian Inglis wrote:
>> Not being in the same Cygwin process group and lacking the appropriate interface
>> info indicates that the invoker was not Cygwin.
> 
> Should I interpret this to mean the "winshell" parameter is not an accurate
> statement of what I thought it was for and because there is no way to reliably
> determine if the calling process was from Cygwin or not, behavior like I suggest
> is actually impossible?

Reread the rules in the article you quoted, carefully, then read:

http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/
[also see linked articles about cmd and batch file command line parsing]

and ask if you really expect anyone else to use or reproduce this insanity,
rather than a sane POSIX parser?
Once again MS "persists in reinventing the square wheel", badly [from Henry
Spencer's Commandments].

What does the Go command line parser actually accept, does it really invert the
parse_cmdline or CommandLineToArgvW rules, and which?

That winshell parameter is set in dcrt0.cc calling build_argv, based on whether
the parent process was Cygwin and an argv array is available preset by the
Cygwin parent, or not and globs are allowed to be expanded, such that the
command line args, quotes, and wildcards have to be handled by the program
according to POSIX shell command line quoting, field splitting, and pathname
expansion rules, respecting $IFS:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html

The similar flag in spawn.cc based on the exe or interpreter exe being under a
Cygwin exec mount in realpath.iscygexec() decides whether the argv array can be
passed a la Unix to a Cygwin child, or a Windows command line needs to be built
with Windows argument double quoting and escaping where required.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

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

  reply	other threads:[~2019-09-04 16:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 19:31 Stephen Provine via cygwin
2019-08-30 20:53 ` Brian Inglis
2019-08-30 21:21 ` Stephen Provine via cygwin
2019-08-31  4:18   ` Brian Inglis
2019-09-03 16:38   ` Stephen Provine via cygwin
2019-09-04 16:20     ` Brian Inglis [this message]
2019-09-04 23:46     ` Stephen Provine via cygwin
2019-09-05  5:29       ` Brian Inglis
2019-09-05 18:31       ` Stephen Provine via cygwin
2019-09-05 19:05         ` Eric Blake
2019-09-05 22:01         ` Stephen Provine via cygwin
2019-09-05 22:46           ` Eric Blake
2019-09-05 23:45           ` Stephen Provine via cygwin
2019-09-06  0:46             ` Steven Penny
2019-09-06  1:26             ` Eric Blake
2019-09-06  6:20             ` Stephen Provine via cygwin
2019-09-07 21:50           ` Brian Inglis
2019-09-07 12:05         ` Andrey Repin
2019-09-07 12:20           ` Andrey Repin
2019-09-09 16:47           ` Stephen Provine via cygwin
2019-09-09 16:57             ` Stephen Provine via cygwin
2019-09-09 17:11               ` Eric Blake
2019-09-09 19:05                 ` Duncan Roe
2019-09-09 19:44                   ` Andrey Repin
2019-09-10 12:43                   ` Brian Inglis

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=f5a94050-695c-d3e9-594b-a8f9972266ac@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --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).