[systemd-devel] systemd-analyze plot issues in 198

Lennart Poettering lennart at poettering.net
Sun Mar 10 18:29:49 PDT 2013


On Sat, 09.03.13 22:48, Kok, Auke-jan H (auke-jan.h.kok at intel.com) wrote:

> 
> On Sat, Mar 9, 2013 at 4:56 PM, Pierre Schmitz <pierre at archlinux.de> wrote:
> > Am 09.03.2013 23:41, schrieb Kok, Auke-jan H:
> >> The problem is that the code is now generating coordinates as follows:
> >>
> >>     <rect class="box" x="0" y="0" width="2204,000" height="3440,000" />
> >>
> >> Obviously, that needs to be a "." and not a ",".
> >>
> >> Do you get proper output if you run `LC_NUMERIC=C systemd-analyze plot` ... ?
> >
> > Good catch, this will produce the following output which renders just
> > fine: http://paste.xinu.at/3IYLR/
> 
> And, it's already fixed in git. Lennart did some cleanups in between
> breakfast and coffee after v198 and committed a cleanup to
> systemd-analyze which includes:
> 
> @@ -776,18 +820,19 @@ int main(int argc, char *argv[]) {
>          DBusConnection *bus = NULL;
> 
>          setlocale(LC_ALL, "");
> +        setlocale(LC_NUMERIC, "C"); /* we want to format/parse floats
> in C style */

Yes, I "fixed" this issue this way the other day. In general I must say
that formatting floats with printf() or parsing them is something we
really shouldn't do. That's inherently locale-based and hence really
broken. Unfortunately libc doesn't really offer any locale-independent
versions, which is quite a limitation.

Setting LC_NUMERIC is a hack that works for trivial cases, but sucks in
many way, as it is a global setting, which should be local. A program
that outputs floats to the user and into generated files as well
interleaved, would have to constantly switch back and forth which is not
only slow but also a nightmare in threaded environments.

I figure bootchart needs to be fixed the same way...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list