This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10969] New: duplocale crashes
- From: "bruno at clisp dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 17 Nov 2009 00:58:19 -0000
- Subject: [Bug libc/10969] New: duplocale crashes
- Reply-to: sourceware-bugzilla at sourceware dot org
The function call duplocale (LC_GLOBAL_LOCALE) crashes.
According to POSIX
<http://www.opengroup.org/onlinepubs/9699919799/functions/duplocale.html>
and <http://www.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html>
it should instead return a duplicate copy of the global locale.
How to reproduce:
Compile and run the attached program.
Rationale:
1) POSIX says that LC_GLOBAL_LOCALE is "a special locale object descriptor",
and the argument of duplocale has to be "a locale object" without further
constraints.
2) The POSIX specification of newlocale says "The results are undefined if
the base argument is the special locale object LC_GLOBAL_LOCALE" but similar
wording is not present in the POSIX specification of duplocale.
3) The call works fine on MacOS X 10.5.
4) POSIX does not foresee any other way to create a copy of the global locale
than through duplocale:
newlocale (LC_ALL_MASK, "", LC_GLOBAL_LOCALE)
has undefined behaviour, and
newlocale (LC_ALL_MASK, nl_langinfo (_NL_LOCALE_NAME (LC_COLLATE)), NULL)
uses API that is specific to glibc, not present in POSIX.
--
Summary: duplocale crashes
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: bruno at clisp dot org
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux
http://sourceware.org/bugzilla/show_bug.cgi?id=10969
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.