commit:     590cbfec1de05635bb5b40cf12d36254a611cdc9
Author:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  3 11:31:40 2025 +0000
Commit:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
CommitDate: Wed Dec  3 11:36:56 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=590cbfec

mail-filter/rspamd: Fix build with Lua 5.1

LUA_OK is not defined in Lua 5.1. The build issue is fixed with a patch
from upstream.

Link: https://github.com/rspamd/rspamd/pull/5774
Closes: https://bugs.gentoo.org/967009
Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org>

 .../rspamd/files/rspamd-3.14.1-lua5.1-fix.patch    | 37 ++++++++++++++++++++++
 mail-filter/rspamd/rspamd-3.14.1.ebuild            |  1 +
 2 files changed, 38 insertions(+)

diff --git a/mail-filter/rspamd/files/rspamd-3.14.1-lua5.1-fix.patch 
b/mail-filter/rspamd/files/rspamd-3.14.1-lua5.1-fix.patch
new file mode 100644
index 000000000000..28401920504c
--- /dev/null
+++ b/mail-filter/rspamd/files/rspamd-3.14.1-lua5.1-fix.patch
@@ -0,0 +1,37 @@
+From 73f7b82ab3507049a752ffc15a0615cd9d7a10df Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <[email protected]>
+Date: Tue, 2 Dec 2025 22:06:16 +0100
+Subject: [PATCH 1/1] [Fix] Use 0 instead of LUA_OK for lua_pcall result
+ comparison
+
+Lua 5.1 does not define LUA_OK, so the result of lua_pcall is compared
+to 0 instead, which is consistent with the rest of the codebase.
+
+Bug: https://bugs.gentoo.org/967009
+Upstream-PR: https://github.com/rspamd/rspamd/pull/5774
+
+diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c
+index 04c8845a1..68617f86d 100644
+--- a/src/rspamadm/confighelp.c
++++ b/src/rspamadm/confighelp.c
+@@ -207,7 +207,7 @@ rspamadm_confighelp_load_plugins_doc(struct rspamd_config 
*cfg)
+       lua_getglobal(L, "require");
+       lua_pushstring(L, "rspamadm.confighelp_plugins");
+ 
+-      if (lua_pcall(L, 1, 1, 0) != LUA_OK) {
++      if (lua_pcall(L, 1, 1, 0) != 0) {
+               rspamd_fprintf(stderr, "cannot load confighelp_plugins module: 
%s\n",
+                                          lua_tostring(L, -1));
+               lua_pop(L, 1);
+@@ -221,7 +221,7 @@ rspamadm_confighelp_load_plugins_doc(struct rspamd_config 
*cfg)
+               return NULL;
+       }
+ 
+-      if (lua_pcall(L, 0, 1, 0) != LUA_OK) {
++      if (lua_pcall(L, 0, 1, 0) != 0) {
+               rspamd_fprintf(stderr, "cannot execute confighelp_plugins 
function: %s\n",
+                                          lua_tostring(L, -1));
+               lua_pop(L, 1);
+-- 
+2.51.0
+

diff --git a/mail-filter/rspamd/rspamd-3.14.1.ebuild 
b/mail-filter/rspamd/rspamd-3.14.1.ebuild
index 9d744185659a..fc67117be93c 100644
--- a/mail-filter/rspamd/rspamd-3.14.1.ebuild
+++ b/mail-filter/rspamd/rspamd-3.14.1.ebuild
@@ -71,6 +71,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-3.12-cmake-lua-version.patch"
        "${FILESDIR}/${PN}-3.14.1-unbundle-lua.patch"
        "${FILESDIR}/${PN}-3.12-unbundle-snowball.patch"
+       "${FILESDIR}/${P}-lua5.1-fix.patch" #967009
 )
 
 src_prepare() {

Reply via email to