public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Fix bogus warnings about runaway Lua scripts (#2254463)
@ 2026-11-23 9:35 Panu Matilainen
0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23 9:35 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 0ae9b336476cfc4291411bc004c79d554e32b83d
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2023-12-15T14:25:11+02:00
Stats : +84/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/0ae9b336476cfc4291411bc004c79d554e32b83d?branch=pmatilai-v6
Log:
Fix bogus warnings about runaway Lua scripts (#2254463)
---
diff --git a/0001-Fix-regression-in-Lua-scriptlet-runaway-child-detect.patch b/0001-Fix-regression-in-Lua-scriptlet-runaway-child-detect.patch
new file mode 100644
index 0000000..40c0c5e
--- /dev/null
+++ b/0001-Fix-regression-in-Lua-scriptlet-runaway-child-detect.patch
@@ -0,0 +1,79 @@
+From bb4aaaa2e8e4bdfc02f9d98ab2982074051c4eb2 Mon Sep 17 00:00:00 2001
+Message-ID: <bb4aaaa2e8e4bdfc02f9d98ab2982074051c4eb2.1702642817.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Fri, 15 Dec 2023 13:15:29 +0200
+Subject: [PATCH] Fix regression in Lua scriptlet runaway child detection
+
+Commit a8107659ef3dd4855729bf65aa4d70f784cb5a5f moved the detection
+to parent using waitpid(), but this causes it to complain on any
+process in the same process group. In the usual rpm context we don't
+have any, but we can't very well tell API users not to have any
+children. And then failed to detect a runaway Lua child in one of
+our own tests. Uff.
+
+rpmlog() in the child has the issues mentioned in the originating
+commit, but that's a problem that needs to be solved elsewhere.
+Revert back to issuing a warning when we actually *are* in the child
+process, so there are no false positive possible. Use EXIT_FAILURE
+like in the original version, dunno why I'd changed that.
+
+Update the rpmlua test to expect the deserved warning, and use
+stdio for printing its "normal" output, the catch there is that we
+need to flush the io in the child.
+
+Reported at https://bugzilla.redhat.com/show_bug.cgi?id=2254463
+---
+ rpmio/rpmlua.c | 10 +++-------
+ tests/rpmmacro.at | 9 ++++-----
+ 2 files changed, 7 insertions(+), 12 deletions(-)
+
+diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c
+index 8ef90e779..854fd469d 100644
+--- a/rpmio/rpmlua.c
++++ b/rpmio/rpmlua.c
+@@ -239,17 +239,13 @@ static int luaopt(int c, const char *oarg, int oint, void *data)
+ static int rpm_pcall(lua_State *L, int nargs, int nresults, int errfunc)
+ {
+ pid_t pid = getpid();
+- int status;
+
+ int rc = lua_pcall(L, nargs, nresults, errfunc);
+
+ /* Terminate unhandled fork from Lua script */
+- if (pid != getpid())
+- _exit(1);
+-
+- if (waitpid(0, &status, WNOHANG) == 0) {
+- rpmlog(RPMLOG_WARNING,
+- _("runaway fork() in Lua script\n"));
++ if (pid != getpid()) {
++ rpmlog(RPMLOG_WARNING, _("runaway fork() in Lua script\n"));
++ _exit(EXIT_FAILURE);
+ }
+
+ return rc;
+diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at
+index 0ebcc050c..47a13ef2b 100644
+--- a/tests/rpmmacro.at
++++ b/tests/rpmmacro.at
+@@ -1322,13 +1322,12 @@ nil No such file or directory 2.0
+ ],
+ [])
+
+-# This uses io.stderr:write() because the grue from the previous test
+-# appears to have eaten stdout of the forked child, or something.
+ RPMTEST_CHECK([
+-runroot_other rpmlua -e 'pid = posix.fork(); if pid == 0 then a,b,c=rpm.redirect2null(-1); io.stderr:write(string.format("%s\t%s\t%s\n", a,b,c)) else posix.wait(pid) end'
++runroot_other rpmlua -e 'pid = posix.fork(); if pid == 0 then a,b,c=rpm.redirect2null(-1); print(string.format("%s\t%s\t%s", a,b,c)); io.flush() else posix.wait(pid) end'
+ ],
+ [0],
+-[],
+ [nil Bad file descriptor 9.0
+-])
++],
++[warning: runaway fork() in Lua script]
++)
+ RPMTEST_CLEANUP
+--
+2.43.0
+
diff --git a/rpm.spec b/rpm.spec
index 37cde3a..f7320c3 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -27,7 +27,7 @@
%global rpmver 4.19.1
#global snapver rc1
-%global baserelease 1
+%global baserelease 2
%global sover 10
%global srcver %{rpmver}%{?snapver:-%{snapver}}
@@ -139,6 +139,7 @@ rpm-4.18.92-disable-sysusers.patch
rpm-4.18.90-weak-user-group.patch
# Patches already upstream:
+0001-Fix-regression-in-Lua-scriptlet-runaway-child-detect.patch
# ...
# These are not yet upstream
@@ -619,6 +620,9 @@ fi
%doc %{_defaultdocdir}/rpm/API/
%changelog
+* Fri Dec 15 2023 Panu Matilainen <pmatilai@redhat.com> - 4.19.1-2
+- Fix bogus warnings about runaway Lua scripts (#2254463)
+
* Tue Dec 12 2023 Michal Domonkos <mdomonko@redhat.com> - 4.19.1-1
- Update to 4.19.1 (https://rpm.org/wiki/Releases/4.19.1)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-23 9:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 9:35 [rpms/rpm] pmatilai-v6: Fix bogus warnings about runaway Lua scripts (#2254463) Panu Matilainen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox