lua-users home
lua-l archive

Re: error when loading strict.lua

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


On 9/14/07, Dirk Feytons <dirk.feytons@gmail.com> wrote:
[...]
I figured it out.
CGILua runs the CGI scripts in a kind of sandbox. For that sandbox it
removes some dangerous globals from _G:
	-- Cleaning environment
	removeglobals {
		"os.execute",
		"loadlib",
		"package",
		"debug",
	}
	-- Build fake package
	_G.package = { seeall = seeall, }
The creation of the fake package triggers the strict code. In that
code there's the function what():
local function what ()
 local d = debug.getinfo(3, "S")
 return d and d.what or "C"
end
Since the 'debug' table is not available anymore the call
'debug.getinfo()' recursively triggers itself again until we hit the C
stack limit.
I changed strict.lua to take a local reference to 'debug.getinfo()' so
it will still work in case the 'debug' table is removed. I don't know
if this change can be done in the official distribution as well?
-- 
Dirk F.

AltStyle によって変換されたページ (->オリジナル) /