lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi all! Today I crashed the Lua interpreter with a seemingly innocent Lua script. The problem was my format string for os.date(), specifically %e (guess how long that took me to find...)

Turns out I read about the %e conversion specification at opengroup.org[1] while I'm running MS Windows :-|. And indeed the MSDN page about strftime[2] doesn't mention %e.

Now comes the fun part: Instead of ignoring/copying invalid specifications, the MS Windows XP SP2 CRT crashes (and takes the Lua interpreter down with it.)

All the Lua manual has to say about this is that the returned string is "formatted according to the same rules as the C function strftime". While I understand that Lua depends on the C runtime, maybe there exists a minimal subset that can be mentioned in the manual? Otherwise we're expecting every user to look up his/her platforms' CRT documentation...

Thanks,

 - Peter

[1] http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
[2] http://msdn2.microsoft.com/en-us/library/fe06s4ak(VS.80).aspx

PS. Interestingly, PHP 5.2.1 doesn't crash on %e, though it does seem to use the C runtime's strftime (might be linked against a different runtime?)

PPS. If anyone needs lua binaries before Lua Binaries is updated, I've put mine online at http://members.home.nl/xolox/lua/. Compiled with VS.NET/C++ Express '05 /O2, Windows SDK /XP32 /RELEASE. Lua compiler statically linked of course ;)