-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR: attempt to index global '_debug' (a nil value) #57
Comments
Interesting. I'll have a look into it. |
It seems like a problem of luaposix
the |
I am confused by this because nowhere in my code does posix is used in lapchan specifically for |
Thanks, I got it. |
@linsir can you try updating luaposix? it was patched to fix this issue. |
yes, I have updated the luaposix ,but get this error.
|
Hi, I cannot reproduce this error. posix._base has: local HAVE_TYPECHECK, typecheck = pcall(require, 'typecheck')
return {
argscheck = HAVE_TYPECHECK and typecheck.argscheck or function(_, fn)
return fn
end,
} and then posix.deprecated has: local _ENV = require 'posix._strict' {
argscheck = require 'posix._base'.argscheck,
} Where posix._strict returns: return function(env, level)
env = strict(env)
setfenv(1+(level or 1), env)
return env
end What version of Lua are you using? Can you reproduce by installing luaposix with luarocks, and a require statement in the REPL? Does it fail with or without |
lapchan runs in a Docker image using luajit and luarocks. I don't believe luastd is installed unless it is a dependency of luaposix. |
if you mean the optional std.strict and std._debug modules, they too are pcall required by luaposix like typecheck above. Nonetheless, I cant reproduce the typecheck error with or without those modules on luajit or puc-rio 5.1, 5.2 or 5.3... and the argscheck setting code above looks correct to me by inspection. If one of you you could send me the details I asked for above and a reproducer please, I'll have a better chance of understanding the failure condition and fixing it. (I'm holding off on a planned luaposix release to make sure it doesnt have this bug btw) |
I don't have the time atm to test this personally so feel free to push your release and if this problem can be tracked down we can work on it at a later date. |
@gvvaughan I got this same error when I explicitly installed Here is the error: |
@byoungdale thanks for the info - do you have a short piece of code that triggers the error with the luarocks you describe installing in place? |
Here is the full stack traceback when the error occurs:
That is all that I am getting. Does that help you at all? I will try to track down what is exactly triggering the error. But, it looks like it's something is |
Thanks, but no new clues in the stack trace :( Maybe instrumenting local _open, _concat, _str = io.open, table.concat, require 'std.normalize'.str --tostring
local require = require
do
local f = _open('/tmp/posix.log', 'w+')
f:write('\n')
f:close()
end
local function log(prefix, ...)
local parms, f = {...}, _open('/tmp/posix.log', 'a+')
f:write(prefix)
for i = 1, #parms do
f:write(_concat{' "', _str(parms[i]), '",'})
end
f:write('\n')
f:close()
return ...
end
package.preload['posix._strict'] = function()
local setfenv = rawget(_G, 'setfenv') or function() end
local strict
do
local ok, _debug = log('posix._strict: ok, debug =', pcall(require, 'std._debug.init'))
if ok and _debug.strict then
ok, strict = pcall(require, 'std.strict.init')
end
if not ok then
strict = function(env)
return env
end
end
end
return log('posix._strict: return ', function(env, level)
env = log('posix._strict: env =', strict(env))
setfenv(1+(level or 1), env)
return env
end)
end
package.preload['posix._base'] = function()
local HAVE_TYPECHECK, typecheck = log('posix._base: HAVE_TYPECHECK, typecheck =', pcall(require, 'typecheck'))
return {
argscheck = log('posix._base: argscheck =', HAVE_TYPECHECK and typecheck.argscheck or function(_, fn)
return fn
end),
}
end
-- posix.deprecated
local _ENV = log('_ENV =', require 'posix._strict' {
argscheck = log('posix.deprecated: argscheck =', require 'posix._base'.argscheck),
})
log('_ENV.argscheck = ', _ENV.argscheck) If you don't have Does the code above work for you? If not, what shows in |
So, I replaced
And nothing is being to the log. |
Oh I wasn't clear enough there, sorry. That wasn't meant to be a direct replacement for If you are able to run that file inside your lapis environment, and the crash still reproduces it will produce a log file that will help me understand what is going wrong. Alternatively, if you'd prefer (or if it's not possible to run that file from lapis), you could use just the If it's not straight forward to hand-roll that, please let me know, and I'll make separate branch in the luaposix repo with the equivalent logging turned on. |
Hi @gvvaughan, I tried to use the log function in various places, but I just kept getting the same |
awesome, thanks for sticking with it. It’ll take me a few days to make the time, but I’ll let you know... |
Just as an FYI to anyone else, I changed these luarocks modules to older versions and was able to get my docker instance of lapis-chan running.
Here is the whole Luarocks install section of my Dockerfile that got everything running again:
Everything else in the Dockerfile is the same. |
@gvvaughan Any update on this issue? Is there a change I should make to Lapis-chan to help it work better with the latest version of luaposix, or is there perhaps a bug in luaposix that is causing this issue? |
Hello, thank you share this project.and I try to run it with docker , but I does't work. this is the error.log.
any idear?
The text was updated successfully, but these errors were encountered: