Project

General

Profile

Actions

Bug #2719

closed

lua_geti symbol is missing lua version

Added by nitrox about 8 years ago. Updated about 8 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_magnet
Target version:
ASK QUESTIONS IN Forums:

Description

'nm mod_magnet.so'

lua_geti

vs.

lua_gettop@LUA_5.2

Actions #1

Updated by gstrauss about 8 years 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?

Actions #2

Updated by stbuehler about 8 years 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.

Actions #3

Updated by gstrauss about 8 years 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

Actions #4

Updated by stbuehler about 8 years ago

  • Target version changed from 1.4.x to 1.4.40
Actions #5

Updated by stbuehler about 8 years ago

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

Applied in changeset r3106.

Actions

Also available in: Atom