[libvirt] setlocale problems / "initialization failed" in Rawhide

Daniel P. Berrange berrange at redhat.com
Mon Feb 29 15:38:46 UTC 2016


On Mon, Feb 29, 2016 at 03:22:58PM +0000, Richard W.M. Jones wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1312688
> 
> When you upgrade from F23 to current Rawhide, you don't get any
> "language pack" installed.  It turns out this breaks many things
> including libvirtd which no longer starts up:
> 
>   $ ./daemon/libvirtd --help
>   /home/rjones/d/libvirt/daemon/.libs/lt-libvirtd: initialization failed
> 
> Simply installing glibc-langpack-en is sufficient to fix this, but I
> was wondering if we should try to make libvirt work anyway.
> 
> The failure comes from setlocale (LC_ALL, "") returning NULL.  The
> attached test program prints:
> 
>   $ ./test 
>   setlocale failed, errno=No such file or directory
> 
> Also attached is the strace output so you can see what files it is
> looking for.
> 
> Seems like solutions to this include:
> 
>  - Make libvirt in Fedora depend on glibc-langpack-en.
> 
>  - Ignore the return value from setlocale.  It seems unlikely that we
>    really care if setlocale fails.  I'm not even sure what it does.

setlocale() configures behaviour of the various locale sensitive
functions. Specifically setlocale() with "" is supposed to modify the
behaviour to match that requested by the various locale environment
variables. If we ignore errors from this, and the user has genuninely
made a error in their env variables, then this will not be visible
any more which kind of sucks IMHO. That said it looks like ignoring
the setlocale() return code is pretty common across UNIX apps.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list