[Nagiosplug-devel] [ nagiosplug-Bugs-1433114 ] check_procs does not work with german locale

SourceForge.net noreply at sourceforge.net
Wed Mar 22 19:26:06 CET 2006


Bugs item #1433114, was opened at 02/16/06 12:00
Message generated for change (Comment added) made by sf-robot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1433114&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parsing problem
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Hadmut Danisch (hadmut)
Assigned to: Ton Voon (tonvoon)
Summary: check_procs does not work with german locale

Initial Comment:
Hi,

check_procs does not work properly if used in Germany. 

Reason:

In Germany/Europe floating numbers are written with a
decimal comma
instead of a decimal point. When you set LC_NUMERIC to
something like
de_DE, the function sscanf expects a decimal comma, not
a decimal
point.


check_procs calls 

  /bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'

and then parses the output. That's where trouble begins. 
The %CPU is written as 0.0, but sscanf now expects a
comma. It
therefore scans only "0", and leaves ".0" for the next
argument, thus
shifting all subsequent arguments one to the right. 

check_procs -C something
therefore does not work anymore.

regards
Hadmut


----------------------------------------------------------------------

>Comment By: SourceForge Robot (sf-robot)
Date: 03/22/06 19:25

Message:
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

----------------------------------------------------------------------

Comment By: Ton Voon (tonvoon)
Date: 03/08/06 08:37

Message:
Logged In: YES 
user_id=664364

Hi! 

Thanks for the bug report and the investigation. check_procs 1.47 has the 
line:

setlocale(LC_NUMERIC, "POSIX");

added, which should fix this problem. Please can you try the snapshot at 
http://nagiosplug.sf.net/snapshot.

I'll place this call into Pending. Please change if the problem persists.

Ton

----------------------------------------------------------------------

Comment By: NotDisplayed123 (lbruun)
Date: 03/08/06 07:44

Message:
Logged In: YES 
user_id=1468749

Right you are. I'm looking at version 1.46 of check_procs 
which seems to try to get around this by doing a 

setlocale(LC_ALL,"")

before using the sscanf function.

The point is that while the sscanf changes with the locale 
the ps command does not, at least not on my platform 
(Solaris). Whether or not the ps command changes its 
behavior according to the locale might be different from 
platform to platform. (just a guess, but this would surely 
complicate things)

Anyway on the Solaris platform the correct behaviour should 
be to do the following in the C code:

setlocale(LC_ALL,"C")

i.e. force the C locale to be used before calling sscanf 
function.

rgds,

Lars



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1433114&group_id=29880




More information about the Devel mailing list