[erlang-questions] os_mon in OS X

Ben Hood 0x6e6562@REDACTED
Tue May 6 14:18:06 CEST 2008


Hi Björn-Egil,

Unfortunately I can't either because my locale doesn't use commas for  
decimal places.

The user that reported this to me (using RabbitMQ server) sent error  
dump via a chat session which I don't have a transcript for. So I have  
asked him to resend it and I will post it.

That user had a German locale so the output of uptime was

1:59  up 1 day,  6:07, 5 users, load averages: 0,77 0,94 1,02

with commas instead of decimal points.

Looking through the code that parses the output from uptime, it  
assumes that you have decimal points.

IMHO It's a really stupid thing from the setup of the OS because by  
localizing the output of well known unix commands, you can potentially  
break a lot of code that parses the output.

However, it resulted in an error whilst using RabbitMQ (which is  
written in Erlang) so we will take this down as a known issue, unless  
of course you feel it is worth fixing.

Thx,

Ben

On 6 May 2008, at 13:06, Björn-Egil Dahlberg wrote:

> Hi Ben,
>
> Ben Hood wrote:
>> The get_uint32_measurement/2 call in cpu_sup seems to throw a bad   
>> match when the locale of the shell that the process is running in  
>> does  not use a decimal point to denote a fraction.
>> For example, if the result of /usr/bin/uptime is
>> 1:59  up 1 day,  6:07, 5 users, load averages: 0,77 0,94 1,02
>> then the get_uint32_measurement fails.
>> This occurs in R12B-1 with uname
>> Darwin Macintosh-3.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  
>> 4  21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
>
> I can't reproduce this error, using:
>
> Darwin dwalin 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  4 21:17:34  
> PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
>
> Since r12b os_mon uses "LANG=C uptime" as basis for load  
> determination on darwin. This should produce,
>
> dwalin:~ egil$ LANG=C uptime
> 14:03  up 7 days, 22:31, 3 users, load averages: 0.10 0.27 0.28
>
> It would be helpful if you could send a complete error dump if/when  
> the error occurs.
>
> Regards,
> Björn-Egil
> Erlang/OTP
>
>




More information about the erlang-questions mailing list