I'd argue _for_ starting up libvirtd in case of errorous LC_* info. Since it is not a user-facing application but a system daemon, I think the impact of wrong language is small, but the benefit of having the daemon starting realiably is quite high. To explain my case as example: I sshed into a server from a weirdly configured desktop that had LC_MESSAGE set to de_DE and ran my script. Even though I set LANG=C there, the daemon would fail. Once I found out, I unset LC_*, but it still failed since tmux/bash "reinherited" the LC_*-stuff from ssh for some reason. It was a mess to debug and in the end I had to unset the env variables on the exec line that I passed on... :-( Anyways, in case you prefer only the verbose error, I attached a "verbose only" version, without the fallback part. Cheers, Andreas P.S. I hope OWA behaves better than HTC's email-app yesterday. ________________________________________ Von: Daniel P. Berrange [berrange@xxxxxxxxxx] Gesendet: Montag, 7. Oktober 2013 18:24 An: Fuchs, Andreas Cc: libvir-list@xxxxxxxxxx Betreff: Re: [PATCH] Be more clever and verbose about localization-initialization. On Mon, Oct 07, 2013 at 06:09:21PM +0200, andreas.fuchs@xxxxxxxxxxxxxxxxx wrote: > I should have been more specific. If e.g. an LC_MESSAGE is > set that cannot be found it returns "initialization failed" > and nothing more... See the bug report.Spent >1h this morning > trying to get some demonstrator running... So I thought rather > share it... You mean if it is set to a language code which is invalid ? I think that should just print a suitable error message and then exit, rather than just switching to C locale 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 :|
From fd9ccbb917794cc20e358bbbac9b55fd549f55dd Mon Sep 17 00:00:00 2001 From: Andreas Fuchs <andreas.fuchs@xxxxxxxxxxxxxxxxx> Date: Mon, 7 Oct 2013 16:07:07 +0200 Subject: [PATCH] Be more verbose about textdomain-initialization. Currently libvirt fails with an uninformative error message if no translations are found. Fixes: * If bindtextdomain fails due to missing language files, report the exact error without translation attempt. https://bugzilla.redhat.com/show_bug.cgi?id=1016158 Signed-off-by: Andreas Fuchs <andreas.fuchs@xxxxxxxxxxxxxxxxx> --- daemon/libvirtd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 99c0342..5e8db0e 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -1133,8 +1133,12 @@ int main(int argc, char **argv) { if (setlocale(LC_ALL, "") == NULL || bindtextdomain(PACKAGE, LOCALEDIR) == NULL || - textdomain(PACKAGE) == NULL || - virInitialize() < 0) { + textdomain(PACKAGE) == NULL) { + fprintf(stderr, "%s: localization initialization failed\n", argv[0]); + exit(EXIT_FAILURE); + } + + if (virInitialize() < 0) { fprintf(stderr, _("%s: initialization failed\n"), argv[0]); exit(EXIT_FAILURE); } -- 1.7.10.4
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list