Bug#327212: [Pkg-nagios-devel] Bug#327212: nagios-common: locale problem breaks ping plugin

sean finney seanius at debian.org
Thu Sep 8 14:55:17 UTC 2005


On Thu, Sep 08, 2005 at 04:38:39PM +0200, alet at unice.fr wrote:
> > export LC_NUMERIC
> > export LC_TIME
> > LC_NUMERIC=POSIX
> > LC_TIME=POSIX
> > /usr/lib/nagios/plugins/check_ping -H 134.59.53.14 -w 10,15% -c 15,20%
> 
> doesn't work.
> 
> en fait, LC_NUMERIC seems to be sufficient, as long as LC_ALL is unset.
> 
> If I do :
> 
>   $ export LC_NUMERIC=POSIX
>   $ /usr/lib/nagios/plugins/check_ping -H 134.59.53.14 -w 10,15% -c 15,20%
>   
> it fails.
>   
> but then :
> 
>   $ unset LC_ALL
>   (here LC_NUMERIC is still defined to be POSIX since we're in the
>    same session)
>   $ /usr/lib/nagios/plugins/check_ping -H 134.59.53.14 -w 10,15% -c 15,20%
>   
> it works   

aha.  spending some time r'ing tfm on locale(7):

       If  the  second  argument  to  setlocale() is empty string, "", for the
       default locale, it is determined using the following steps:

       1.     If there is a non-null environment variable LC_ALL, the value of
              LC_ALL is used.

       2.     If an environment variable with the same name as one of the cat-
              egories above exists and is non-null, its value is used for that
              category.

       3.     If  there  is a non-null environment variable LANG, the value of
              LANG is used.

so LC_ALL trumps all other settings, then the individual settings like
LC_NUMERIC etc, then LANG.  i don't know much about how the default
locale is set up for debian boxes when you use a different locale... are
both environemnt variables LC_ALL and LANG set to the same value, or is
only LC_ALL set?  

if they're both set then simply unsetting LC_ALL before setting LC_NUMERIC
etc would work afaict.  otherwise we'd have to do something like fetch
LC_ALL, unset it, set LC_NUMERIC etc, and then put the original value
of LC_ALL into LANG.


	sean

-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20050908/433e6b1f/attachment.pgp


More information about the Pkg-nagios-devel mailing list