[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT support "1.0" number format in German (and other) locales
- From: Mike Pall <mikelu-1103@...>
- Date: Wed, 9 Mar 2011 12:04:29 +0100
Mason Larobina wrote:
> Numbers of the format "1.0" cause luakit to crash when linked against
> LuaJIT in German (and other) locales. Changing all .'s to ,'s solves
> the problem (though that's not really a solution) and forcing a
> non-German locale also works.
This is not a "crash" by any definition. Please watch your
Applications embedding Lua or LuaJIT should NOT set a numeric
locale or explicitly set it to "C". Yes, this applies to _both_ VMs.
Actually Lua has an ugly workaround for the issue with the parser.
But it still fails with tonumber() and the explicit (tostring())
or implicit number-to-string conversions. This affects e.g.
print() and so on.
The problem is deep inside libc in strtod() and sprintf(). These
can neither be easily replaced, nor easily convinced to ignore the
I do not believe in curing a single symptom, so I won't add any
kind of incomplete workaround for this to LuaJIT.
One needs to fix the root cause, i.e. the embedding (luakit) must
use setlocale(LC_NUMERIC, "C") after any setlocale calls in 3rd
party libraries, but before initializing Lua or LuaJIT.