Wireshark-dev: Re: [Wireshark-dev] Luacov with Wireshark Lua dissector plugin
From: Shakthi Kannan <shakthimaan@xxxxxxxxx>
Date: Mon, 5 Feb 2018 12:59:25 +0530
Hi,

--- On Fri, Feb 2, 2018 at 9:01 PM, Peter Wu <peter@xxxxxxxxxxxxx> wrote:
> It looks like "console.lua" is setting the "debug" function. Perhaps
> those "helpers" should be removed or namespaced, as a workaround you can
> just comment the debug function:
>
>     -- function debug(x) ... end

I tried the above, but, when Wireshark is started, it actually throws
the error at:

"~/.luarocks/share/lua/5.1/luacov/hook.lua:26:attempt to index global
'debug' (a function value)".

In hook.lua, when the local variable "name" is assigned to the full
path of the Lua plugin prefixed by "@", the coverage statistics get
generated. Bascially, the following is used to retrieve the name:

  local name = debug.getinfo(level, "S").source -- returns "@dissector.lua"

So, the following hard-coded assginment works:

  local name = "@dissector.lua"
  local prefixed_name = string.match(name, "^@(.*)")

I am not sure why debug module or function is used to retrieve the
path to the Wireshark Lua plugin. Will check with the Luacov author.

Thanks for your reply. Appreciate it!

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com