public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* newlocale: Linux incompatibility
@ 2023-03-23 19:48 Ken Brown
  2023-03-23 20:09 ` Thomas Wolff
  2023-03-23 21:14 ` Corinna Vinschen
  0 siblings, 2 replies; 11+ messages in thread
From: Ken Brown @ 2023-03-23 19:48 UTC (permalink / raw)
  To: cygwin

I'm reporting this here rather than the newlib list because the behavior 
is compatible with Posix but not Linux, so I think it's a Cygwin issue.

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.  Posix doesn't say what should happen on an invalid locale, so 
this is not, strictly speaking, a bug.

Ken

P.S. I noticed this because of a failing Emacs test.  No one else has 
reported this test failure, so it seems that newlocale fails on an 
invalid locale on all platforms supported by Emacs other than Cygwin.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-03-25 21:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 19:48 newlocale: Linux incompatibility Ken Brown
2023-03-23 20:09 ` Thomas Wolff
2023-03-23 21:14 ` Corinna Vinschen
2023-03-24 12:18   ` Corinna Vinschen
2023-03-24 13:57     ` Ken Brown
2023-03-24 14:44       ` Corinna Vinschen
2023-03-24 22:49     ` Brian Inglis
2023-03-25 11:49       ` Corinna Vinschen
2023-03-25 19:03         ` Brian Inglis
2023-03-25 21:19           ` Corinna Vinschen
2023-03-25 21:26           ` Corinna Vinschen

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