I Just tried compiling and testing the 8.22 release, in order to do a comparison. But the test failed in the exact same way.
I also did tests on a similar but yet different arch linux installation at work, with the exact same results.

When compiling coreutils 8.22 on 2014-03-14 the tests succeeded. So whatever changed must be outside of coreutils.

One thing I noticed is that locale.h from the gnulib has the line:
#define setlocale rpl_setlocale
which doesn't seem to come into play (as it is my system's setlocale which is called from the test).

I have noticed that systemd has a localectl function, but doesn't list any changed behavior w.r.t. locales and environment variables, however, could systemd be the culprit?

Again, thanks.
Henrik


On Sun, Jul 20, 2014 at 1:48 AM, Henrik Juul Pedersen <henrikjuul@gmail.com> wrote:
I'm a bit rusty at gdb, but here's what I've been able to find:

I compiled coreutils with -ggdb3 and was able to see, that the test called gl_locale_name_posix, which used my systems current setlocale (do debugging symbols):

Breakpoint 5, 0x00007ffff7a582b4 in setlocale () from /usr/lib/libc.so.6
(gdb) step
Single stepping until exit from function setlocale,
which has no line number information.
gl_locale_name_posix (category=5, categoryname=0x4035f3 "LC_MESSAGES") at localename.c:2704
2704 }
(gdb) 
gl_locale_name (category=5, categoryname=0x4035f3 "LC_MESSAGES") at localename.c:2854
2854  if (retval != NULL)
(gdb) 
2855    return retval;
(gdb) 
2858 }
(gdb) 
test-localename.c:86: assertion 'strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), gl_locale_name_default ()) == 0' failed

retval from setlocale is:
(gdb) p retval
$11 = 0x606f00 "en_US.UTF-8"

So I'm unsure what to do next?

My GNU libc version is:
% pacman -Qi glibc
Name           : glibc
Version        : 2.19-5
Description    : GNU C Library
Architecture   : x86_64
[ ... ]
Build Date     : 2014-05-16T10:15:30 CEST
Install Date   : 2014-05-30T16:11:30 CEST

Thanks,
Henrik


On Sat, Jul 19, 2014 at 5:07 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
Henrik Juul Pedersen wrote:

gl_locale_name(LC_MESSAGES (int 5), 'LC_MESSAGES'): en_US.UTF-8
gl_locale_name_default(): C

Thanks, since LC_MESSAGES is supposed to be unset at that point, gl_locale_name appears to be the culprit.  Can you use GDB to figure out why it's returning "en_US.UTF-8"?  You may need to recompile with "gcc -O0 -g3" to get decent debugging output.  Or, if you can't use GDB, just put in printf statements.