[smokeping-users] Echoping again

Niko Tyni ntyni+smokeping-users at mappi.helsinki.fi
Thu Feb 8 13:48:44 CET 2007


On Thu, Feb 08, 2007 at 10:48:12AM +0100, Jacek Osiecki wrote:

> Actually, it was the only version I had in my linux distro (PLD linux).
> Which one should I use?

Echoping 5.2 should work out of the box, but the only incompatibility
with Smokeping that I'm aware of is the '-h' option.

> >Hm, this could be a locale problem (rrdtool uses strtod(3), which
> >honors locales), except that lib/Smokeping.pm already resets LC_NUMERIC.
> >Try to run in the C locale or similar anyway, to rule that out.
> 
> It might be this issue - I am using locale pl_PL, and in Poland we have
> comma instead of dot for separating decimal part in numbers... I'll try
> running smokeping in C locale and will report here.

Ah, it looks like LC_ALL from the environment overrides LC_NUMERIC
set inside Smokeping.pm. I assume you're using that? 

I'm not sure if resetting LC_ALL in Smokeping is a good idea...probably
not. I guess it's best to bail out with an error message if the locale
switch doesn't succeed. Does the attached patch do that for you?

Cheers,
-- 
Niko
-------------- next part --------------
--- smokeping-2.0.9/lib/Smokeping.pm	2007/02/08 12:43:06	1.1
+++ smokeping-2.0.9/lib/Smokeping.pm	2007/02/08 12:46:53
@@ -19,7 +19,9 @@
 # make sure we do not end up with , in odd places where one would expect a '.'
 # we set the environment variable so that our 'kids' get the benefit too
 $ENV{LC_NUMERIC}='C';
-POSIX::setlocale(&POSIX::LC_NUMERIC,"");
+if (POSIX::setlocale(&POSIX::LC_NUMERIC,"") ne "C") {
+    die("Resetting LC_NUMERIC failed - try removing LC_ALL from the environment");
+}
 
 use File::Basename;
 use Smokeping::Examples;


More information about the smokeping-users mailing list