public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: Resurrect long since broken Lua library path
Date: Mon, 23 Nov 2026 09:32:09 GMT [thread overview]
Message-ID: <179542632962.1.2012699933739229066.rpms-rpm-5460ad1e1770@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 5460ad1e1770f3ba64828f340fe8b1479fd051dd
Author : Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Date : 2018-10-16T11:24:03+02:00
Stats : +124/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/5460ad1e1770f3ba64828f340fe8b1479fd051dd?branch=pmatilai-v6
Log:
Resurrect long since broken Lua library path
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
---
diff --git a/0001-Resurrect-long-since-broken-Lua-library-path.patch b/0001-Resurrect-long-since-broken-Lua-library-path.patch
new file mode 100644
index 0000000..e81fe39
--- /dev/null
+++ b/0001-Resurrect-long-since-broken-Lua-library-path.patch
@@ -0,0 +1,118 @@
+From dd6c65044c41922193f520ace668e2c5e55f1004 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Tue, 16 Oct 2018 11:26:46 +0300
+Subject: [PATCH] Resurrect long since broken Lua library path
+
+LUA_PATH global variable is not consulted when loading libraries in
+Lua >= 5.1, package.path has replaced it. Rpm's Lua library path
+was always supposed to be /usr/lib/rpm/lua/ but this has been broken
+for the last ten years or so, oops. Make the directory a first-class
+citizen: create it on install, add a macro for it, make it actually
+work and ensure it stays that way by adding a test for it.
+---
+ Makefile.am | 2 ++
+ macros.in | 2 ++
+ rpmio/rpmlua.c | 13 ++++++-------
+ tests/rpmmacro.at | 17 ++++++++++++++++-
+ 4 files changed, 26 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index ff40ffbd1..813bdb834 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -249,6 +249,7 @@ install-data-local:
+ $(RPMCANONVENDOR) $(RPMCANONOS) $(RPMCANONGNU)
+ @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
+ @$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/macros.d
++ @$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/lua
+
+ # XXX to appease distcheck we need to remove "stuff" here...
+ uninstall-local:
+@@ -257,6 +258,7 @@ uninstall-local:
+ @rm -rf $(DESTDIR)$(rpmconfigdir)/platform/
+ @rm -f $(DESTDIR)$(rpmconfigdir)/macros
+ @rm -rf $(DESTDIR)$(rpmconfigdir)/macros.d
++ @rm -rf $(DESTDIR)$(rpmconfigdir)/lua
+
+ MAINTAINERCLEANFILES = ChangeLog
+
+diff --git a/macros.in b/macros.in
+index 00f382da1..e0a1aea4e 100644
+--- a/macros.in
++++ b/macros.in
+@@ -149,6 +149,8 @@
+ %_rpmconfigdir %{getconfdir}
+ # The directory where rpm's macro files live
+ %_rpmmacrodir %{_rpmconfigdir}/macros.d
++# The directory where rpm's addon lua libraries live
++%_rpmluadir %{_rpmconfigdir}/lua
+
+ # The directory where sources/patches will be unpacked and built.
+ %_builddir %{_topdir}/BUILD
+diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c
+index 8a1fa73e4..e67d2fb52 100644
+--- a/rpmio/rpmlua.c
++++ b/rpmio/rpmlua.c
+@@ -124,13 +124,6 @@ rpmlua rpmluaNew()
+ }
+ #ifndef LUA_GLOBALSINDEX
+ lua_pushglobaltable(L);
+-#endif
+- lua_pushliteral(L, "LUA_PATH");
+- lua_pushfstring(L, "%s/%s", rpmConfigDir(), "/lua/?.lua");
+-#ifdef LUA_GLOBALSINDEX
+- lua_rawset(L, LUA_GLOBALSINDEX);
+-#else
+- lua_settable(L, -3);
+ #endif
+ lua_pushliteral(L, "print");
+ lua_pushcfunction(L, rpm_print);
+@@ -142,6 +135,12 @@ rpmlua rpmluaNew()
+ #ifndef LUA_GLOBALSINDEX
+ lua_pop(L, 1);
+ #endif
++
++ lua_getglobal(L, "package");
++ lua_pushfstring(L, "%s/%s", rpmConfigDir(), "/lua/?.lua");
++ lua_setfield(L, -2, "path");
++ lua_pop(L, 1);
++
+ rpmluaSetData(lua, "lua", lua);
+ if (stat(initlua, &st) != -1)
+ (void)rpmluaRunScriptFile(lua, initlua);
+diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at
+index 88d2a0519..8875490db 100644
+--- a/tests/rpmmacro.at
++++ b/tests/rpmmacro.at
+@@ -303,6 +303,21 @@ runroot rpm \
+ )
+ AT_CLEANUP
+
++AT_SETUP([lua library path])
++AT_KEYWORDS([macros lua])
++AT_CHECK([
++AT_SKIP_IF([$LUA_DISABLED])
++f=$(rpm --eval "%{_rpmconfigdir}/lua/foo.lua")
++echo "bar = 'graak'" > ${f}
++runroot rpm \
++ --eval '%{lua:require "foo"; print(bar)}'
++rm -f ${f}
++],
++[0],
++[graak
++])
++AT_CLEANUP
++
+ AT_SETUP([%define + %undefine in nested levels 1])
+ AT_KEYWORDS([macros define undefine])
+ AT_CHECK([
+@@ -438,4 +453,4 @@ runroot rpm --macros "/data/macros.testfile" \
+
+ macro_2
+ ])
+-AT_CLEANUP
+\ No newline at end of file
++AT_CLEANUP
+--
+2.19.1
+
diff --git a/rpm.spec b/rpm.spec
index bccbd11..c217620 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -23,7 +23,7 @@
%global rpmver 4.14.2
#global snapver rc2
-%global rel 7
+%global rel 8
%global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@@ -60,6 +60,7 @@ Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
# Patches already upstream:
Patch101: 0001-Fix-ancient-python-GIL-locking-bug-on-callback-RhBug.patch
+Patch102: 0001-Resurrect-long-since-broken-Lua-library-path.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -482,6 +483,7 @@ make check || (cat tests/rpmtests.log; exit 1)
%attr(0755, root, root) %dir %{rpmhome}
%{rpmhome}/macros
%{rpmhome}/macros.d
+%{rpmhome}/lua
%{rpmhome}/rpmpopt*
%{rpmhome}/rpmrc
@@ -580,6 +582,9 @@ make check || (cat tests/rpmtests.log; exit 1)
%doc doc/librpm/html/*
%changelog
+* Tue Oct 16 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.14.2-8
+- Resurrect long since broken Lua library path
+
* Fri Oct 12 2018 Panu Matilainen <pmatilai@redhat.com> - 4.14.2-7
- Actually fail build on test-suite failures again
- Invoke python2 explicitly from test-suite to unbreak build, part II
reply other threads:[~2026-11-23 9:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542632962.1.2012699933739229066.rpms-rpm-5460ad1e1770@fedoraproject.org \
--to=ignatenkobrain@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox