qnxor / macoh

Automated stress tests for measuring throttle and temperature on Macs
GNU General Public License v2.0
38 stars 6 forks source link

No graphs produced #5

Closed laurihoefs closed 10 years ago

laurihoefs commented 10 years ago

No graphs are produced after the tests have completed, although logs are generated.

An example of the error message: 'macoh.sh: line 587: printf: 19.501791: invalid number' Numbers change according to the test being run and the results, but all tests fail with the same error.

Tests fail with Finnish UI language and localization selected in OS X preferences, but not with English or German. No other languages/locales tested this far.

OS X version 10.9.3 build 13D45a.

qnxor commented 10 years ago

Definitely sounds like a localization issue. Seems like bash's printf cares about localization.

laurihoefs commented 10 years ago

This might be the issue: It seems the Finnish localization has a slightly different date format from most European localizations. For example, may 1, 2014 in the Finnish format would be 1.5.2014, when with most others it would be 01.05.2014.

qnxor commented 10 years ago

The error relates to decimals though, not dates. Finnish uses a comma , for decimals, and bash's internal printf tries to parse a dot . in 19.501791 using %f but it's locale aware so it fails. It's easy to fix though, I'll submit a patch soon.

laurihoefs commented 10 years ago

German and Swedish locales use comma as a decimal separator too, but do not cause similar issues. I'm curious, what's the difference?

qnxor commented 10 years ago

I take it that you changed your locale to German and Swedish and didn't get any error. How did you change the locale exaxctly? Was the Terminal already running? If yes, the $LANG env var may not change for the running bash session (unless you change it there). I'm not going to bother too much about this though as I can fix it easily. I hate dealing with locales in general ...

laurihoefs commented 10 years ago

Closed Terminal.app -> changed language and locale to German -> rebooted -> opened Terminal.app -> no error Closed Terminal.app -> changed language and locale to Finnish -> rebooted -> opened Terminal.app -> error Closed Terminal.app -> changed language and locale to English -> rebooted -> opened Terminal.app -> no error Closed Terminal.app -> changed language and locale to Finnish -> rebooted -> opened Terminal.app -> error

But if it's fixed, or it's only an issue with the Finnish locale, then does not really matter that much either.

qnxor commented 10 years ago

It's fixed, yes. I suspect that the locale settings (at least on your machine) for German use a dot . for decimals. Try changing it to German then do this in bash: printf '%f\n' 1. My guess is that it will say 1.000000 and not 1,000000 ... but I've been wrong before.

laurihoefs commented 10 years ago

No, you are correct. I used the default settings in each locale, and sure enough: the Finnish locale sets comma as the decimal separator in bash, while the German and Swedish locales use a dot.