newlocale: Linux incompatibility
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Mar 24 14:44:02 GMT 2023
On Mar 24 09:57, Ken Brown via Cygwin wrote:
> On 3/24/2023 8:18 AM, Corinna Vinschen via Cygwin wrote:
> > On Mar 23 22:14, Corinna Vinschen via Cygwin wrote:
> > > On Mar 23 15:48, Ken Brown via Cygwin wrote:
> > > > Consider the following test case:
> > > >
> > > > $ cat locale_test.c
> > > > #include <stdio.h>
> > > > #include <locale.h>
> > > >
> > > > int main ()
> > > > {
> > > > const char *locale = "en_DE.UTF-8";
> > > > locale_t loc = newlocale (LC_COLLATE_MASK | LC_CTYPE_MASK, locale, 0);
> > > > if (!loc)
> > > > perror ("newlocale");
> > > > else
> > > > printf ("newlocale succeeded on invalid locale %s\n", locale);
> > > > }
> > > >
> > > > $ gcc -o locale_test locale_test.c
> > > >
> > > > $ ./locale_test.exe
> > > > newlocale succeeded on invalid locale en_DE.UTF-8
> > > >
> > > > On Linux, the newlocale call fails with ENOENT, as is documented on the man
> > > > page.
> > > Three bugs in fact.
> > > [...]
> > I pushed a couple of patches which hopefully clean up the code.
> > [...]
> > If you want to test this, the changes are in test release
> > 3.5.0-0.260.gb5b67a65f87c, which is just building.
>
> That was fast! I can confirm that newlocale now fails with ENOENT on the
> invalid locale en_XY.utf8.
Thanks for testing!
Corinna
More information about the Cygwin
mailing list