public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Mingye Wang <arthur2e5@aosc.io>
Cc: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: rewrite cmdline parser
Date: Mon, 9 Nov 2020 11:04:54 +0100	[thread overview]
Message-ID: <20201109100454.GX33165@calimero.vinschen.de> (raw)
In-Reply-To: <20201107121221.6668-2-arthur2e5@aosc.io>

Hi Mingye,

On Nov  7 20:12, Mingye Wang wrote:
> This commit rewrites the cmdline parser to achieve the following:
> * MSVCRT compatibility. Except for the single-quote handling (an
>   extension for compatibility with old Cygwin), the parser now
>   interprets option boundaries exactly like MSVCR since 2008. This fixes
>   the issue where our escaping does not work with our own parsing.
> * Clarity. Since globify() is no longer responsible for handling the
>   opening and closing of quotes, the code is much simpler.
> * Sanity. The GLOB_NOCHECK flag is removed, so a failed glob correctly
>   returns the literal value. Without the change, anything path-like
>   would be garbled by globify's escaping.
> * A memory leak in the @file expansion is removed by rewriting it to use
>   a stack of buffers. This also simplifies the code since we no longer
>   have to move stuff. The "downside" is that tokens can no longer cross
>   file boundaries.
> 
> Some clarifications are made in the documentation for when globs are not
> expanded.
> 
> The change fixes two complaints of mine:
> * That cygwin is incompatible with its own escape.[1]
> * That there is no way to echo `C:\"` from win32.[2]
>   [1]: https://cygwin.com/pipermail/cygwin/2020-June/245162.html
>   [2]: https://cygwin.com/pipermail/cygwin/2019-October/242790.html
> 
> (It's never the point to spawn cygwin32 from cygwin64. Consistency
> matters: with yourself always, and with the outside world when you are
> supposed to.)

This looks already pretty good now, but there's a problem when building:

  winsup/cygwin/winf.cc:67:1: error: no declaration matches ‘bool linebuf::fromargv(av&, const char*, bool, bool)’
     67 | linebuf::fromargv (av& newargv, const char *real_path, bool trunc_for_cygwin, bool forcequote)
	| ^~~~~~~
  In file included from winsup/cygwin/winf.cc:16:
  winsup/cygwin/winf.h:76:15: note: candidate is: ‘bool linebuf::fromargv(av&, const char*, bool)’
     76 |   bool __reg3 fromargv(av&, const char *, bool);;
	|               ^~~~~~~~
  winsup/cygwin/winf.h:64:7: note: ‘class linebuf’ defined here
     64 | class linebuf
	|       ^~~~~~~

The declaration in winf.h is actually missing the "forcequote" arg.  Is
"forcequote" supposed to be a default parameter?  If so, defaulting to
true or false? 

However, given that *both* calls to fromargv() don't set forcequote at
all, it will be the same value for all callers and thus it's entirely
redundant.  So why not just drop it?

Also, this change

> +#if defined (__x86_64__) || defined (__CYGMAGIC__) || !defined (__GNUC__)

is entirely unrelated and should go into it's own patch explaining
why it's necessary.  After all, we're building Cygwin with gcc only...


Thanks,
Corinna

  reply	other threads:[~2020-11-09 10:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05  5:27 [PATCH v4 1/3] Cygwin: rewrite and make public " Mingye Wang
2020-09-05  5:27 ` [PATCH v4 2/3] regparm: make code highlight happy Mingye Wang
2020-09-07  9:11   ` Corinna Vinschen
2020-09-05  5:27 ` [PATCH v4 3/3] testsuite: don't strip dir from obj files Mingye Wang
2020-09-07  9:14   ` Corinna Vinschen
2020-11-07 12:12   ` [PATCH v5] Cygwin: rewrite cmdline parser Mingye Wang
2020-11-07 12:12     ` [PATCH] " Mingye Wang
2020-11-09 10:04       ` Corinna Vinschen [this message]
2021-05-13 13:15     ` [PATCH v6] " Mingye Wang
2021-05-13 13:28       ` Mingye Wang
2021-05-14 19:38       ` Johannes Schindelin
2021-05-17 11:03         ` Corinna Vinschen
2020-09-07  9:39 ` [PATCH v4 1/3] Cygwin: rewrite and make public " Corinna Vinschen
2020-09-24  8:39   ` Mingye Wang (Artoria2e5)
2020-10-13 12:14     ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2020-06-24 22:35 [PATCH] Cygwin: rewrite " Mingye Wang

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=20201109100454.GX33165@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=arthur2e5@aosc.io \
    --cc=cygwin-patches@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).