[BUG core?] Regression with parsing Windows’ command-line

Corinna Vinschen corinna-cygwin@cygwin.com
Sat Dec 3 15:24:53 GMT 2022


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




More information about the Cygwin mailing list