From: Vladimír Čunát Date: Wed, 10 Apr 2019 11:59:14 +0000 (+0200) Subject: fixup! sandbox: table_print prints function signatures instead of pointers X-Git-Tag: v4.0.0~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac8f24fa6ba3095676308a5306b88bde2c136102;p=thirdparty%2Fknot-resolver.git fixup! sandbox: table_print prints function signatures instead of pointers --- diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index 33da8ca96..3d79b6615 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -363,12 +363,12 @@ local function funcsign(f) pcall(function() local oldhook local delay = 2 - local function hook(event, line) + local function hook() delay = delay - 1 if delay == 0 then -- call this only for the introspected function for i = 1, math.huge do -- stack depth 2 is the introspected function - local k, v = debug.getlocal(2, i) + local k = debug.getlocal(2, i) if (k or '('):sub(1, 1) == '(' then break -- internal variable, skip else @@ -385,8 +385,8 @@ local function funcsign(f) end oldhook = debug.sethook(hook, "c") -- invoke hook() on function call -- fake arguments, necessary to detect vararg functions - fakearg = {} - for j = 1, 64 do fakearg[#fakearg + 1] = true end + local fakearg = {} + for _ = 1, 64 do fakearg[#fakearg + 1] = true end f(unpack(fakearg)) -- huh? end) return "(" .. table.concat(func_args, ", ") .. ")" @@ -442,6 +442,7 @@ function table_print (tt, indent, done) end end else -- not a table + local tt_str if type(tt) == "function" then tt_str = string.format("function%s\n", funcsign(tt)) else