[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Some luaposix quirks
- From: "Gary V. Vaughan" <gary@...>
- Date: Thu, 6 Nov 2014 20:46:21 +0000
Hi Bernd,
> On Nov 6, 2014, at 4:24 PM, Bernd Eggink <monoped@sudrala.de> wrote:
>
> Testing luaposix-33, I stumbled upon these things:
>
> * The files in /usr/share/lua/5.2/posix/ use a variable _DEBUG which is
> not declared local. This causes programs to crash where "require
> 'strict'" precedes "require 'posix'". Has this variable intentionally
> been made global?
Yes, but only as a stop gap.
The idea is that if you set _G._DEBUG = false before requiring any luaposix
Lua code, it turns off argument type checking across every function call
boundary.
The next release will instead integrate with lua-stdlib's debug_init module,
and only perform the argument type checks if std.debug_init.argcheck ~= false
(and when lua-stdlib is available, by implication). Which in turn can be
influenced by first setting _G._DEBUG in the global environment before requiring
it.
> * Calling "stat(f)" where f is the name of a non-existing file causes
> this error message
> /usr/share/lua/5.2/posix/deprecated.lua:932: attempt to index local
> 'info' (a nil value)
>
> instead of just returning nil. I think the corresponding line should read:
>
> return info and doselection ("stat", 1, {...}, {
Indeed. Fixed in master, thanks for the report.
Cheers,
--
Gary V. Vaughan (gary AT vaughan DOT pe)