Project

General

Profile

Bug #2719

lua_geti symbol is missing lua version

Added by nitrox over 1 year ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_magnet
Target version:
Start date:
2016-03-05
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

'nm mod_magnet.so'

lua_geti

vs.

lua_gettop@LUA_5.2

Associated revisions

Revision 3106 (diff)
Added by stbuehler over 1 year ago

[mod_magnet] define lua_pushglobaltable (for lua5.1) and use it (fixes #2719)

From: Stefan Bühler <>

Revision 82ee3fb2 (diff)
Added by stbuehler over 1 year ago

[mod_magnet] define lua_pushglobaltable (for lua5.1) and use it (fixes #2719)

From: Stefan Bühler <>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3106 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1 Updated by gstrauss over 1 year ago

In my local build,

nm .libs/mod_magnet.so | grep lua

does not show any versioned symbols, but the symbol resolves for me. Does the lua_geti symbol resolve for you?
$ objdump -T /usr/lib64/liblua.so | grep lua_geti
0000000000011430 g    DF .text    0000000000000595  Base        lua_getinfo
00000000000090d0 g    DF .text    00000000000000d0  Base        lua_geti

Are you able to start up lighttpd and load the module?

Would you please describe in a little bit more detail the problem you are having?

#2 Updated by stbuehler over 1 year ago

Reported on IRC:

(plugin.c.226) dlopen() failed for: /usr/local/lib/mod_magnet.so /usr/local/lib/mod_magnet.so: undefined symbol: lua_geti

We use lua_geti when lua-version >= 5.2, but it is only available in 5.3.

#3 Updated by gstrauss over 1 year ago

That lua_geti() could be changed to lua_rawgeti(), but I prefer lua_pushglobaltable()
http://www.lua.org/source/5.2/lua.h.html
http://stackoverflow.com/questions/10087226/lua-5-2-lua-globalsindex-alternative

diff --git a/src/mod_magnet.c b/src/mod_magnet.c
index 114d41e..6e0d4a1 100644
--- a/src/mod_magnet.c
+++ b/src/mod_magnet.c
@@ -164,7 +164,7 @@ static int mod_magnet_patch_connection(server *srv, connection *con, plugin_data

 static void magnet_get_global_table(lua_State *L) { /* (-0, +1, e) */
 #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 502
-       lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
+       lua_pushglobaltable(L);
 #else
        lua_pushvalue(L, LUA_GLOBALSINDEX);
 #endif

#4 Updated by stbuehler over 1 year ago

  • Target version changed from 1.4.x to 1.4.40

#5 Updated by stbuehler over 1 year ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r3106.

Also available in: Atom