This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug localedata/10503] New: setlocale returns a valid locale and sets errno to ENOENT
- From: "Pedro dot Izecksohn at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 10 Aug 2009 05:35:29 -0000
- Subject: [Bug localedata/10503] New: setlocale returns a valid locale and sets errno to ENOENT
- Reply-to: sourceware-bugzilla at sourceware dot org
If $LANG is any available locale other than C or POSIX,
If /usr/lib/locale/locale-archive does not exist setlocale is setting errno to
ENOENT.
If locale data are stored in /usr/lib/locale/<locale_name>/LC_* files, then
/usr/lib/locale/locale-archive is not needed and errno must not be set.
Try to compile and run the code below:
// slt.c
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
char *c = setlocale (LC_NUMERIC, "");
fprintf (stderr, "errno = %s\n", strerror (errno));
fprintf (stderr, "setlocale (LC_NUMERIC, \"\") returned %s\n", c);
return 0;
}
// The C code ended.
Example:
pedro@ubuntu:~/programming/c/setlocale problem$ ./slt.Ubuntu64
errno = Success
setlocale (LC_NUMERIC, "") returned pt_BR.utf8
pedro@ubuntu:~/programming/c/setlocale problem$ sudo mv
/usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.valid
[sudo] password for pedro:
pedro@ubuntu:~/programming/c/setlocale problem$ ./slt.Ubuntu64
errno = No such file or directory
setlocale (LC_NUMERIC, "") returned pt_BR.utf8
--
Summary: setlocale returns a valid locale and sets errno to
ENOENT
Product: glibc
Version: 2.9
Status: NEW
Severity: normal
Priority: P2
Component: localedata
AssignedTo: libc-locales at sources dot redhat dot com
ReportedBy: Pedro dot Izecksohn at gmail dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=10503
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.