Rebase to rpm 4.14.2.1

This commit is contained in:
Panu Matilainen 2018-10-22 14:39:48 +03:00
parent 69ee4d255a
commit 4fa277df97
5 changed files with 7 additions and 169 deletions

1
.gitignore vendored
View File

@ -31,3 +31,4 @@
/rpm-4.14.2-rc1.tar.bz2
/rpm-4.14.2-rc2.tar.bz2
/rpm-4.14.2.tar.bz2
/rpm-4.14.2.1.tar.bz2

View File

@ -1,46 +0,0 @@
From 531dc8495cd3aabd3f659ecab604106fdbacbe98 Mon Sep 17 00:00:00 2001
Message-Id: <531dc8495cd3aabd3f659ecab604106fdbacbe98.1539244476.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 3 Oct 2018 11:51:38 +0300
Subject: [PATCH] Fix ancient python GIL locking bug on callback
(RhBug:1632488)
Introduced in commit c7881d801745b4c156a8aa2afc17b95f97481e34 back in 2002,
synthesizing a python object for the callback occurs before retaking
the GIL lock, which is not allowed. Somehow this has managed to stay
latent all these years, and even now requires fairly specific conditions:
when the callback gets called without an associated key, such as erasures
or file trigger script start/stop events (in the case of RhBug:1632488),
when Python 3 is running in PYTHONMALLOC=debug mode,
it crashes with "Python memory allocator called without holding the GIL".
Simply retake the lock before any Python operations take place to fix.
---
python/rpmts-py.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index e4c5e1250..1ddfc9a1e 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -495,6 +495,8 @@ rpmtsCallback(const void * hd, const rpmCallbackType what,
if (cbInfo->cb == Py_None) return NULL;
+ PyEval_RestoreThread(cbInfo->_save);
+
/* Synthesize a python object for callback (if necessary). */
if (pkgObj == NULL) {
if (h) {
@@ -506,8 +508,6 @@ rpmtsCallback(const void * hd, const rpmCallbackType what,
} else
Py_INCREF(pkgObj);
- PyEval_RestoreThread(cbInfo->_save);
-
args = Py_BuildValue("(iLLOO)", what, amount, total, pkgObj, cbInfo->data);
result = PyEval_CallObject(cbInfo->cb, args);
Py_DECREF(args);
--
2.17.1

View File

@ -1,118 +0,0 @@
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

View File

@ -21,9 +21,9 @@
%define rpmhome /usr/lib/rpm
%global rpmver 4.14.2
%global rpmver 4.14.2.1
#global snapver rc2
%global rel 9
%global rel 1
%global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@ -59,8 +59,6 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
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
Patch103: 0001-rpmfc-push-name-epoch-version-release-macro-before-i.patch
# These are not yet upstream
@ -583,6 +581,9 @@ make check || (cat tests/rpmtests.log; exit 1)
%doc doc/librpm/html/*
%changelog
* Mon Oct 22 2018 Panu Matilainen <pmatilai@redhat.com> - 4.14.2.1-1
- Rebase to rpm 4.14.2.1 (http://rpm.org/wiki/Releases/4.14.2.1)
* Wed Oct 17 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.14.2-9
- Push name/epoch/version/release macro before invoking depgens

View File

@ -1 +1 @@
SHA512 (rpm-4.14.2.tar.bz2) = 22e309e8be936e6070430cedd6f5ea0c3871db4c6aadd0d567a9c418796c178c8dd45d44920d7eaa66681790cc2821347affe471cb215d7a490fe7947fbf291c
SHA512 (rpm-4.14.2.1.tar.bz2) = 0aad457f91918904c15649a1764ce7cbfaf38e083678031286e866f7997be0435a6b7b73596706d97e9263cff7b4df4a3150b142d81e6e3fddbfcf67bd83f990