Re: [libvirt] [PATCH] Be more clever and verbose about localization-initialization.

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... ----- Reply message ----- Von: "Daniel P. Berrange" <berrange@redhat.com> An: "Fuchs, Andreas" <andreas.fuchs@sit.fraunhofer.de> Cc: "libvir-list@redhat.com" <libvir-list@redhat.com> Betreff: [libvirt] [PATCH] Be more clever and verbose about localization-initialization. Datum: Mo., Okt 7, 2013 17:52 On Mon, Oct 07, 2013 at 03:47:48PM +0000, Fuchs, Andreas wrote:
Currently libvirt fails with an uninformative error message if no translations are found.
I don't see any failure if I delete all the libvirt.mo files. What are you actually doing to trigger an error, and what is the exact error you get. 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 :|

On Mon, Oct 07, 2013 at 06:09:21PM +0200, andreas.fuchs@sit.fraunhofer.de 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 :|

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@redhat.com] Gesendet: Montag, 7. Oktober 2013 18:24 An: Fuchs, Andreas Cc: libvir-list@redhat.com Betreff: Re: [libvirt] [PATCH] Be more clever and verbose about localization-initialization. On Mon, Oct 07, 2013 at 06:09:21PM +0200, andreas.fuchs@sit.fraunhofer.de 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 :|

On 10/08/2013 01:35 AM, Fuchs, Andreas wrote:
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.
I still think that someone setting up the wrong language is a case of admin error, and that failing to start is appropriate. But this issue just caused a second bugzilla today: https://bugzilla.redhat.com/show_bug.cgi?id=1026514 so you aren't the only one to have hit the issue. However, in reading that bug, Dan Walsh (now cc'd) apparently didn't even find the stderr message that tried to alert him to why libvirtd was exiting early. Whether or not we apply your patch, there's the meta-issue that if libvirtd under systemd outputs an error to its stderr, where does that message go and how does an admin find out why libvirtd exited early? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/04/2013 04:11 PM, Eric Blake wrote:
On 10/08/2013 01:35 AM, Fuchs, Andreas wrote:
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.
I still think that someone setting up the wrong language is a case of admin error, and that failing to start is appropriate. But this issue just caused a second bugzilla today:
https://bugzilla.redhat.com/show_bug.cgi?id=1026514
so you aren't the only one to have hit the issue. However, in reading that bug, Dan Walsh (now cc'd) apparently didn't even find the stderr message that tried to alert him to why libvirtd was exiting early. Whether or not we apply your patch, there's the meta-issue that if libvirtd under systemd outputs an error to its stderr, where does that message go and how does an admin find out why libvirtd exited early?
Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Starting Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Started Virtualization daemon. Oct 14 17:43:48 redsox.boston.devel.redhat.com libvirtd[646]: /usr/sbin/libvirtd: initialization failed Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: libvirtd.service: main process exited, code=exited, status=1/FAILURE Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Unit libvirtd.service entered failed state. Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: libvirtd.service holdoff time over, scheduling restart. Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Stopping Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Starting Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Started Virtualization daemon. This is what I was getting. libvirt initialization failed. Of course when I ran it myself it worked fine. Since the user session had the correct LANG set. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJ4EUYACgkQrlYvE4MpobOpPQCfb6oN3Vxw48ccyG2eVBwV3Xks G5sAoIftVHsM1NSq705OB0H+hCpeTFuJ =T8QH -----END PGP SIGNATURE-----

Hi all, @Eric, the problem is that there is no "Why" in the error message. @DanielW, you had the exact oposite problem of myself. I had correct language-settings for the service, but when I tried to start libvirtd from the user directly, it used the wrong LC_MESSAGE that it inherited from the ssh connection. ;-) So specifically for all those people that try to ssh from a localized desktop into a localization-free server-box (which is very common I suppose), I think the "fallback to LC_ALL=C" approach with some warning message to stderr would be the preferable solution. Cheers, Andreas ________________________________________ Von: Daniel J Walsh [dwalsh@redhat.com] Gesendet: Montag, 4. November 2013 22:27 An: Eric Blake; Fuchs, Andreas; Daniel P. Berrange Cc: libvir-list@redhat.com Betreff: Re: [libvirt] [PATCH] Be more clever and verbose about localization-initialization. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/04/2013 04:11 PM, Eric Blake wrote:
On 10/08/2013 01:35 AM, Fuchs, Andreas wrote:
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.
I still think that someone setting up the wrong language is a case of admin error, and that failing to start is appropriate. But this issue just caused a second bugzilla today:
https://bugzilla.redhat.com/show_bug.cgi?id=1026514
so you aren't the only one to have hit the issue. However, in reading that bug, Dan Walsh (now cc'd) apparently didn't even find the stderr message that tried to alert him to why libvirtd was exiting early. Whether or not we apply your patch, there's the meta-issue that if libvirtd under systemd outputs an error to its stderr, where does that message go and how does an admin find out why libvirtd exited early?
Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Starting Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Started Virtualization daemon. Oct 14 17:43:48 redsox.boston.devel.redhat.com libvirtd[646]: /usr/sbin/libvirtd: initialization failed Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: libvirtd.service: main process exited, code=exited, status=1/FAILURE Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Unit libvirtd.service entered failed state. Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: libvirtd.service holdoff time over, scheduling restart. Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Stopping Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Starting Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Started Virtualization daemon. This is what I was getting. libvirt initialization failed. Of course when I ran it myself it worked fine. Since the user session had the correct LANG set. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJ4EUYACgkQrlYvE4MpobOpPQCfb6oN3Vxw48ccyG2eVBwV3Xks G5sAoIftVHsM1NSq705OB0H+hCpeTFuJ =T8QH -----END PGP SIGNATURE-----

Hi all, I just wanted to query about the status of this, since my personal tracker just reminded me... Is it rejected ? Does it need rework ? ...? Would be a pitty if something this simple got lost over time... Bug-Entry: https://bugzilla.redhat.com/show_bug.cgi?id=1016158 Patch-Pointers: Option 1 (warning with fallback): https://www.redhat.com/archives/libvir-list/2013-October/msg00294.html Option 2 (verbose error only): https://www.redhat.com/archives/libvir-list/2013-October/msg00318.html Thanks, Andreas ________________________________________ Von: Fuchs, Andreas Gesendet: Dienstag, 5. November 2013 09:22 Hi all, @Eric, the problem is that there is no "Why" in the error message. @DanielW, you had the exact oposite problem of myself. I had correct language-settings for the service, but when I tried to start libvirtd from the user directly, it used the wrong LC_MESSAGE that it inherited from the ssh connection. ;-) So specifically for all those people that try to ssh from a localized desktop into a localization-free server-box (which is very common I suppose), I think the "fallback to LC_ALL=C" approach with some warning message to stderr would be the preferable solution. Cheers, Andreas ________________________________________ Von: Daniel J Walsh [dwalsh@redhat.com] Gesendet: Montag, 4. November 2013 22:27 An: Eric Blake; Fuchs, Andreas; Daniel P. Berrange Cc: libvir-list@redhat.com Betreff: Re: [libvirt] [PATCH] Be more clever and verbose about localization-initialization. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/04/2013 04:11 PM, Eric Blake wrote:
On 10/08/2013 01:35 AM, Fuchs, Andreas wrote:
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.
I still think that someone setting up the wrong language is a case of admin error, and that failing to start is appropriate. But this issue just caused a second bugzilla today:
https://bugzilla.redhat.com/show_bug.cgi?id=1026514
so you aren't the only one to have hit the issue. However, in reading that bug, Dan Walsh (now cc'd) apparently didn't even find the stderr message that tried to alert him to why libvirtd was exiting early. Whether or not we apply your patch, there's the meta-issue that if libvirtd under systemd outputs an error to its stderr, where does that message go and how does an admin find out why libvirtd exited early?
Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Starting Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Started Virtualization daemon. Oct 14 17:43:48 redsox.boston.devel.redhat.com libvirtd[646]: /usr/sbin/libvirtd: initialization failed Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: libvirtd.service: main process exited, code=exited, status=1/FAILURE Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Unit libvirtd.service entered failed state. Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: libvirtd.service holdoff time over, scheduling restart. Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Stopping Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Starting Virtualization daemon... Oct 14 17:43:48 redsox.boston.devel.redhat.com systemd[1]: Started Virtualization daemon. This is what I was getting. libvirt initialization failed. Of course when I ran it myself it worked fine. Since the user session had the correct LANG set. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJ4EUYACgkQrlYvE4MpobOpPQCfb6oN3Vxw48ccyG2eVBwV3Xks G5sAoIftVHsM1NSq705OB0H+hCpeTFuJ =T8QH -----END PGP SIGNATURE-----

On Mon, Nov 04, 2013 at 02:11:55PM -0700, Eric Blake wrote:
On 10/08/2013 01:35 AM, Fuchs, Andreas wrote:
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.
I still think that someone setting up the wrong language is a case of admin error, and that failing to start is appropriate. But this issue just caused a second bugzilla today:
https://bugzilla.redhat.com/show_bug.cgi?id=1026514
so you aren't the only one to have hit the issue. However, in reading that bug, Dan Walsh (now cc'd) apparently didn't even find the stderr message that tried to alert him to why libvirtd was exiting early. Whether or not we apply your patch, there's the meta-issue that if libvirtd under systemd outputs an error to its stderr, where does that message go and how does an admin find out why libvirtd exited early?
It goes to the journal. 'systemctl status libvirtd.service' will show it, or 'journalcal --unit libvirtd.service' will to 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 :|

On 10/07/2013 10:09 AM, andreas.fuchs@sit.fraunhofer.de wrote: [please don't top-post on technical lists, and also fix your mailer to use proper In-Reply-To headers rather than creating a new thread on a reply. Also, line wrapping wouldn't hurt]
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...
Which bug? [/me goes and looks] Oh, you mean https://bugzilla.redhat.com/show_bug.cgi?id=1016158 Don't make us go on a goose hunt. Post the relevant details directly in your commit message, rather than assuming that everyone else actively follows the bug database and can correlate the two without effort. Just because you spent >1hr hunting down the problem doesn't mean that you should make everyone else likewise spend time because of an incomplete report.
----- Reply message ----- Von: "Daniel P. Berrange" <berrange@redhat.com> An: "Fuchs, Andreas" <andreas.fuchs@sit.fraunhofer.de> Cc: "libvir-list@redhat.com" <libvir-list@redhat.com> Betreff: [libvirt] [PATCH] Be more clever and verbose about localization-initialization. Datum: Mo., Okt 7, 2013 17:52
On Mon, Oct 07, 2013 at 03:47:48PM +0000, Fuchs, Andreas wrote:
Currently libvirt fails with an uninformative error message if no translations are found.
I don't see any failure if I delete all the libvirt.mo files.
What are you actually doing to trigger an error, and what is the exact error you get.
According to the BZ, this is a formula for triggering the error:
If bindtextdomain failes due to non-existing localization information, libvirtd dies upon startup with a very generic error:
LC_MESSAGES=non_LANG libvirtd libvirtd: initialization failed
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 10/07/2013 10:25 AM, Eric Blake wrote:
On 10/07/2013 10:09 AM, andreas.fuchs@sit.fraunhofer.de wrote:
[please don't top-post on technical lists, and also fix your mailer to use proper In-Reply-To headers rather than creating a new thread on a reply. Also, line wrapping wouldn't hurt]
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...
Which bug? [/me goes and looks]
Oh, you mean https://bugzilla.redhat.com/show_bug.cgi?id=1016158
Don't make us go on a goose hunt. Post the relevant details directly in your commit message, rather than assuming that everyone else actively follows the bug database and can correlate the two without effort. Just because you spent >1hr hunting down the problem doesn't mean that you should make everyone else likewise spend time because of an incomplete report.
I just re-read what I wrote... Email is a lousy medium for conveying emotion. I apologize for sounding a bit too harsh, and want to thank you for taking the time to report an issue. More importantly, thanks for posting a patch! Too many people report issues without any further effort. Even if we end up going with a slightly different patch, the fact that you showed initiative is a positive thing, and I was wrong for forgetting to express appreciation, with a net result of conveying the wrong tone in my first reply. Please continue to contribute, and don't use my (poor) behavior as an excuse to run away. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (5)
-
andreas.fuchs@sit.fraunhofer.de
-
Daniel J Walsh
-
Daniel P. Berrange
-
Eric Blake
-
Fuchs, Andreas