public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [BUG core?] Regression with parsing Windows’ command-line
Date: Sat, 3 Dec 2022 16:24:53 +0100	[thread overview]
Message-ID: <Y4tqRcDmkQ8SyFQe@calimero.vinschen.de> (raw)
In-Reply-To: <20221203192810.03c73015303ef3ad4fe241f3@nifty.ne.jp>

On Dec  3 19:28, Takashi Yano via Cygwin wrote:
> On Fri, 2 Dec 2022 19:40:30 -0800
> Ilya Zakharevich wrote:
> > On Wed, Nov 16, 2022 at 04:48:25AM -0800, I wrote:
> > > De-quoting (converting the Windows’ command-line into argc/argv) does
> > > not remove double quotes if characters not fit for 8-bit (?) are present.
> > > 
> > > To reproduce, do in CMD’s command line:
> > > 
> > >   D:\> D:\Programs\cygwin2022\bin\perl -wle "print for @ARGV" . "/i/" "/и/" .
> > >   .
> > >   /i/
> > >   "/и/"
> > >   .
> > [...]
> This certainly seems to be a problem of cygwin1.dll.
> 
> Though I am not sure this is the right thing, I have confirmed
> that the following patch solves the issue.
> 
> diff --git a/newlib/libc/locale/lctype.c b/newlib/libc/locale/lctype.c
> index 644669765..732d132e1 100644
> --- a/newlib/libc/locale/lctype.c
> +++ b/newlib/libc/locale/lctype.c
> @@ -25,11 +25,20 @@
>  
>  #define LCCTYPE_SIZE (sizeof(struct lc_ctype_T) / sizeof(char *))
>  
> +#ifdef __CYGWIN__
> +static char	numsix[] = { '\6', '\0'};
> +#else
>  static char	numone[] = { '\1', '\0'};
> +#endif
>  
>  const struct lc_ctype_T _C_ctype_locale = {
> +#ifdef __CYGWIN__
> +	"UTF-8",			/* codeset */
> +	numsix				/* mb_cur_max */
> +#else
>  	"ASCII",			/* codeset */
>  	numone				/* mb_cur_max */
> +#endif

Good idea, but this transforms the "C" locale into the "C.UTF-8" locale
once and for all.

What we're actually missing is a matching _C_utf8_ctype_locale which can
be used by Cygwin as default locale setting, AFAICS.

I pushed a patch and the test release is rebuilding while I type.


Thanks,
Corinna



  parent reply	other threads:[~2022-12-03 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 12:48 Ilya Zakharevich
2022-12-03  3:40 ` Ilya Zakharevich
2022-12-03 10:28   ` Takashi Yano
2022-12-03 13:42     ` Takashi Yano
2022-12-03 15:29       ` Corinna Vinschen
2022-12-03 15:24     ` Corinna Vinschen [this message]
2022-12-03 15:39       ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2022-11-15  5:58 Ilya Zakharevich

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=Y4tqRcDmkQ8SyFQe@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --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).