I submitted this before to bug-glibc (#77294). However, it appears to
have been closed without a thorough reading.
The recommended usage of setlocale in the libc info pages is
char *tmp = strdup (setlocale (LC_NUMERIC, NULL));
setlocale (LC_NUMERIC, "C");
setlocale (LC_NUMERIC, tmp);
This interface implies that setlocale copies the string being passed in.
If it didn't the last setlocale (... tmp) would store a pointer to a freed
string. Unfortunately, this appears to have happened. The next time
through this type of operation setlocale (.. NULL) returns the freed
pointer. When we attempt to assign that later the sanity checks realize
it is invalid, and silently switches to "C". The program seems to work,
but LC_NUMERIC is now wrong.
This needs to be addressed before glibc-2.2 gets too widely used. I'm
already receiving bug reports in gnumeric as a result. If there is
anything I can do the help please contact me.
Working on a fix.
Fixed in glibc-2.2-9.