From: Brett Neumeier Date: Tue, 13 Jan 2026 15:03:47 +0000 (-0600) Subject: Allow for use of Lua 5.5 X-Git-Tag: 4.0.0~191^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d668cbb7d41fbee18a6c8a40666f90e6d3689ddc;p=thirdparty%2Frspamd.git Allow for use of Lua 5.5 In Lua 5.5, the signature for lua_newstate changes (there is now an additional "seed" argument), and the mechanism for adjusting garbage collection also changes. I don't know whether the seed of 0 is ideal when using lua_newstate; probably, using a random seed would be better. This is a minimal patch that gets back to a working build. --- diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 2ec4d6c728..2d362af6dc 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -931,8 +931,12 @@ rspamd_lua_init(bool wipe_mem) #ifdef WITH_LUAJIT /* TODO: broken on luajit without GC64 */ L = luaL_newstate(); +#else +#if LUA_VERSION_NUM >= 505 + L = lua_newstate(rspamd_lua_wipe_realloc, NULL, 0); #else L = lua_newstate(rspamd_lua_wipe_realloc, NULL); +#endif #endif } else { @@ -1089,8 +1093,13 @@ void rspamd_lua_start_gc(struct rspamd_config *cfg) lua_settop(L, 0); /* Set up GC */ lua_gc(L, LUA_GCCOLLECT, 0); +#if LUA_VERSION_NUM >= 505 + lua_gc(L, LUA_GCPARAM, LUA_GCPSTEPMUL, cfg->lua_gc_step); + lua_gc(L, LUA_GCPARAM, LUA_GCPPAUSE, cfg->lua_gc_pause); +#else lua_gc(L, LUA_GCSETSTEPMUL, cfg->lua_gc_step); lua_gc(L, LUA_GCSETPAUSE, cfg->lua_gc_pause); +#endif lua_gc(L, LUA_GCRESTART, 0); }