public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/python3-rpm] epel9: Merge epel9-next into epel9
Date: Fri, 13 Nov 2026 18:33:34 GMT [thread overview]
Message-ID: <179459481452.1.14802351525178978068.rpms-python3-rpm-d5003bf3a04d@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9
Commit : d5003bf3a04d13fcf03c4228547abae247dd7e5c
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2026-11-13T17:48:35+01:00
Stats : +660/-2 in 6 file(s)
URL : https://src.fedoraproject.org/rpms/python3-rpm/c/d5003bf3a04d13fcf03c4228547abae247dd7e5c?branch=epel9
Log:
Merge epel9-next into epel9
---
diff --git a/0001-Extract-archiver-detection-out-of-doUncompress.patch b/0001-Extract-archiver-detection-out-of-doUncompress.patch
new file mode 100644
index 0000000..ad499b0
--- /dev/null
+++ b/0001-Extract-archiver-detection-out-of-doUncompress.patch
@@ -0,0 +1,143 @@
+From 7aabd4c44b5cf015ac3854cc16fc23e23a87f224 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Fri, 23 Oct 2026 14:01:04 +0200
+Subject: [PATCH 1/3] Extract archiver detection out of doUncompress()
+
+Move the logic to determine the command line string to an internal macro
+API function called rpmGetArchiver(). This will be needed in the
+subsequent commit.
+
+No functional change.
+---
+ rpmio/macro.c | 82 +++++++++++++++++++++++----------------
+ rpmio/rpmmacro_internal.h | 8 ++++
+ 2 files changed, 57 insertions(+), 33 deletions(-)
+
+diff --git a/rpmio/macro.c b/rpmio/macro.c
+index 490bf9a6a..6eef3cd2f 100644
+--- a/rpmio/macro.c
++++ b/rpmio/macro.c
+@@ -1107,7 +1107,7 @@ doSP(MacroBuf mb, int chkexist, int negate,
+ static void doUncompress(MacroBuf mb, int chkexist, int negate,
+ const char * f, size_t fn, const char * g, size_t gn)
+ {
+- rpmCompressedMagic compressed = COMPRESSED_OTHER;
++ const char *cmd = NULL;
+ char *b, *be, *buf = NULL;
+ int c;
+
+@@ -1123,40 +1123,10 @@ static void doUncompress(MacroBuf mb, int chkexist, int negate,
+ if (gn == 0 || *b == '\0')
+ goto exit;
+
+- if (rpmFileIsCompressed(b, &compressed))
++ if (rpmGetArchiver(b, &cmd))
+ mb->error = 1;
+
+- switch (compressed) {
+- default:
+- case COMPRESSED_NOT:
+- expandMacro(mb, "%__cat ", 0);
+- break;
+- case COMPRESSED_OTHER:
+- expandMacro(mb, "%__gzip -dc ", 0);
+- break;
+- case COMPRESSED_BZIP2:
+- expandMacro(mb, "%__bzip2 -dc ", 0);
+- break;
+- case COMPRESSED_ZIP:
+- expandMacro(mb, "%__unzip ", 0);
+- break;
+- case COMPRESSED_LZMA:
+- case COMPRESSED_XZ:
+- expandMacro(mb, "%__xz -dc ", 0);
+- break;
+- case COMPRESSED_LZIP:
+- expandMacro(mb, "%__lzip -dc ", 0);
+- break;
+- case COMPRESSED_LRZIP:
+- expandMacro(mb, "%__lrzip -dqo- ", 0);
+- break;
+- case COMPRESSED_7ZIP:
+- expandMacro(mb, "%__7zip x ", 0);
+- break;
+- case COMPRESSED_ZSTD:
+- expandMacro(mb, "%__zstd -dc ", 0);
+- break;
+- }
++ expandMacro(mb, cmd, 0);
+ mbAppendStr(mb, buf);
+
+ exit:
+@@ -2004,3 +1974,49 @@ rpmExpandNumeric(const char *arg)
+
+ return rc;
+ }
++
++int
++rpmGetArchiver(const char *fn, const char **cmd)
++{
++ int rc = 0;
++ rpmCompressedMagic compressed = COMPRESSED_OTHER;
++ const char *s = NULL;
++
++ if (rpmFileIsCompressed(fn, &compressed))
++ rc = 1;
++
++ switch (compressed) {
++ default:
++ case COMPRESSED_NOT:
++ s = "%__cat ";
++ break;
++ case COMPRESSED_OTHER:
++ s = "%__gzip -dc ";
++ break;
++ case COMPRESSED_BZIP2:
++ s = "%__bzip2 -dc ";
++ break;
++ case COMPRESSED_ZIP:
++ s = "%__unzip ";
++ break;
++ case COMPRESSED_LZMA:
++ case COMPRESSED_XZ:
++ s = "%__xz -dc ";
++ break;
++ case COMPRESSED_LZIP:
++ s = "%__lzip -dc ";
++ break;
++ case COMPRESSED_LRZIP:
++ s = "%__lrzip -dqo- ";
++ break;
++ case COMPRESSED_7ZIP:
++ s = "%__7zip x ";
++ break;
++ case COMPRESSED_ZSTD:
++ s = "%__zstd -dc ";
++ break;
++ }
++
++ *cmd = s;
++ return rc;
++}
+diff --git a/rpmio/rpmmacro_internal.h b/rpmio/rpmmacro_internal.h
+index a59671be8..eca7511da 100644
+--- a/rpmio/rpmmacro_internal.h
++++ b/rpmio/rpmmacro_internal.h
+@@ -19,6 +19,14 @@ extern "C" {
+ RPM_GNUC_INTERNAL
+ const char *findMacroEnd(const char *str);
+
++/** \ingroup rpmmacro
++ * Return a command line (without fn) for extracting the archive fn.
++ * Always returns a command line, even on failure.
++ * @param fn filename of the archive
++ * @retval cmd command line (with a trailing space)
++ * @return 0 on success, 1 on failure
++ */
++int rpmGetArchiver(const char *fn, const char **cmd);
+
+ #ifdef __cplusplus
+ }
+--
+2.56.0
+
diff --git a/0001-Fix-rpopen-rpclose-and-make-them-more-POSIXy.patch b/0001-Fix-rpopen-rpclose-and-make-them-more-POSIXy.patch
new file mode 100644
index 0000000..2028741
--- /dev/null
+++ b/0001-Fix-rpopen-rpclose-and-make-them-more-POSIXy.patch
@@ -0,0 +1,153 @@
+From c745bd8ee4b383897927eb2e504dba9b97aa7b03 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Tue, 3 Nov 2026 08:48:11 +0100
+Subject: [PATCH] Fix rpopen()/rpclose() and make them more POSIXy
+
+Commit 7a4111bc5db4053e5381b65306903837763e7f11 introduced this new pair
+of drop-in replacements for popen()/pclose() but did so somewhat poorly.
+Apart from obvious bugs, there are various less obvious issues that make
+the functions ever so slightly not POSIX conforming. We are not shipping
+them in a generic library, obviously, but the internal callers that used
+to call the original functions could, at least in theory, be affected in
+some unexpected ways and cause regressions.
+
+Namely, the following issues were found:
+
+- rpclose() returned the extracted exit status from the child instead of
+ the original status from waitpid(2), which caused a child exit status
+ of 128 to be considered a "success" in rpmuncompress, oops
+- rpclose() waited on any child, not just the one spawned with rpopen()
+- EINTR wasn't ignored while busy waiting in rpclose()
+- pipe ends weren't always closed in case of failures
+- rpclose() only closed the stream after waiting on the child
+- the child didn't return 127 if the shell couldn't be invoked
+- the shell command didn't use -- to signal the end of options
+
+Fix the issues, and while at it, name the FILE pointer "fp" rather than
+"stream" and use do-while rather than while, for better consistency with
+the existing code as well as readability. Also do some refactoring there
+and add a couple of comments.
+
+Related: CVE-2026-84837, CVE-2026-84838
+Fixes: #4385
+(cherry picked from commit b9127abde15ec1a5d936891f7d5f78ddc5b689ff)
+---
+ cliutils.c | 58 ++++++++++++++++++++++++++++++++----------------------
+ cliutils.h | 2 +-
+ 2 files changed, 36 insertions(+), 24 deletions(-)
+
+diff --git a/cliutils.c b/cliutils.c
+index 6547e7bdb..5edb9fea7 100644
+--- a/cliutils.c
++++ b/cliutils.c
+@@ -14,6 +14,7 @@
+ #include "debug.h"
+
+ static pid_t pipeChild = 0;
++static pid_t rpopenChild = 0;
+
+ RPM_GNUC_NORETURN
+ void argerror(const char * desc)
+@@ -89,53 +90,64 @@ int finishPipe(void)
+
+ FILE* rpopen(const char *cmd, const char *arg, ...)
+ {
+- FILE *stream = NULL;
++ FILE *fp = NULL;
++ int pipefd[2];
+ ARGV_t argv = NULL;
+ va_list ap;
+- int pipefd[2];
+- pid_t pid;
+
+ if (pipe(pipefd) < 0)
+- goto exit;
++ return NULL;
++
++ if ((fp = fdopen(pipefd[0], "r")) == NULL) {
++ close(pipefd[0]);
++ close(pipefd[1]);
++ return NULL;
++ }
+
+ argvAdd(&argv, "/bin/sh");
+ argvAdd(&argv, "-c");
+- argvAdd(&argv, cmd);
+- argvAdd(&argv, "sh");
++ argvAdd(&argv, "--");
++ argvAdd(&argv, cmd); /* User command */
++ argvAdd(&argv, "sh"); /* Shell name ($0) */
+
++ /* User positional parameters ($1, $2, ...) */
+ va_start(ap, arg);
+ for (const char *s = arg; s != NULL; s = va_arg(ap, const char *))
+ argvAdd(&argv, s);
+ va_end(ap);
+
+- if ((pid = fork()) == 0) {
++ if ((rpopenChild = fork()) == 0) {
+ dup2(pipefd[1], STDOUT_FILENO);
++ close(pipefd[1]);
+ close(pipefd[0]);
+ execv(argv[0], argv);
+- _exit(EXIT_FAILURE);
+- } else if (pid == -1) {
+- goto exit;
++ _exit(127);
++ } else if (rpopenChild == -1) {
++ fclose(fp);
++ fp = NULL;
+ }
+
+ close(pipefd[1]);
+- stream = fdopen(pipefd[0], "r");
+-
+-exit:
+ argvFree(argv);
+- return stream;
++
++ return fp;
+ }
+
+-int rpclose(FILE *stream)
++int rpclose(FILE *fp)
+ {
+- int rc = -1;
+- int status;
++ int status = -1;
++ pid_t reaped;
+
+- if ((waitpid(-1, &status, 0) == -1) || !WIFEXITED(status))
+- goto exit;
++ if (rpopenChild <= 0)
++ return -1;
+
+- rc = WEXITSTATUS(status);
++ fclose(fp);
++ do {
++ reaped = waitpid(rpopenChild, &status, 0);
++ } while (reaped == -1 && errno == EINTR);
+
+-exit:
+- fclose(stream);
+- return rc;
++ if (reaped == -1)
++ return -1;
++
++ return status;
+ }
+diff --git a/cliutils.h b/cliutils.h
+index 4aee1ae72..600ccfa95 100644
+--- a/cliutils.h
++++ b/cliutils.h
+@@ -28,6 +28,6 @@ int finishPipe(void);
+ * $2, and so on.
+ */
+ FILE *rpopen(const char *cmd, const char *arg, ...) RPM_GNUC_NULL_TERMINATED;
+-int rpclose(FILE *stream);
++int rpclose(FILE *fp);
+
+ #endif /* _CLIUTIL_H */
+--
+2.56.0
+
diff --git a/0001-Prevent-command-injection-via-rpmbuild-t.patch b/0001-Prevent-command-injection-via-rpmbuild-t.patch
new file mode 100644
index 0000000..e4455d2
--- /dev/null
+++ b/0001-Prevent-command-injection-via-rpmbuild-t.patch
@@ -0,0 +1,79 @@
+From 9aa517baeceec55c02678c7bf89713448dd70bb6 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Wed, 26 Aug 2026 10:53:12 +0200
+Subject: [PATCH] Prevent command injection via rpmbuild -t
+
+When running in -t mode, the spec member name in the passed tarball will
+get macro-expanded twice: first when constructing the target filename in
+getTarSpec() and then in parseSpec(). This allows a crafted tarball to
+execute arbitrary code when the user just runs rpmbuild -ts or similar.
+
+Luckily, neither of these expansions is necessary, they are only done as
+a convenience and/or historical artifact. The former in getTarSpec() was
+only added recently via commit dfffedb5ebe46e039c0313b3d2fb939dfc63efd6
+and can easily be split into a basename(3) call so that the member name
+is not included in the expansion, effectively reverting that part of the
+original commit. The latter seems to be only used as a way to normalize
+the spec filename stored in the rpmSpec struct and can be replaced by a
+mere rpmCleanPath().
+
+Make both changes, and add a corresponding test, too.
+
+Fixes: CVE-2026-78367, #4314
+(backported from commit 2a11eb3e4e51094082e0123aebd797ec051dc094)
+---
+ build/parseSpec.c | 2 +-
+ rpmbuild.c | 9 +++++++--
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/build/parseSpec.c b/build/parseSpec.c
+index 2fd29e178..4d62c337c 100644
+--- a/build/parseSpec.c
++++ b/build/parseSpec.c
+@@ -895,7 +895,7 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
+ /* Set up a new Spec structure with no packages. */
+ spec = newSpec();
+
+- spec->specFile = rpmGetPath(specFile, NULL);
++ spec->specFile = rpmCleanPath(xstrdup(specFile));
+ pushOFI(spec, spec->specFile);
+ /* If buildRoot not specified, use default %{buildroot} */
+ if (buildRoot) {
+diff --git a/rpmbuild.c b/rpmbuild.c
+index d02caa511..8dbd06d5f 100644
+--- a/rpmbuild.c
++++ b/rpmbuild.c
+@@ -337,6 +337,8 @@ static int isSpecFile(const char * specfile)
+ static char * getTarSpec(const char *arg)
+ {
+ char *specFile = NULL;
++ char *specDir = NULL;
++ char *specBase = NULL;
+ char *specFinal = NULL;
+ const char **spec;
+ char tarbuf[BUFSIZ];
+@@ -386,9 +388,11 @@ static char * getTarSpec(const char *arg)
+ if (!gotspec) {
+ rpmlog(RPMLOG_ERR, _("Failed to read spec file from %s\n"), arg);
+ } else {
++ specDir = rpmExpand("%{_specdir}", NULL);
++ specBase = basename(tarbuf);
+ /* remove trailing \n */
+- tarbuf[strlen(tarbuf)-1] = '\0';
+- specFinal = rpmExpand("%{_specdir}/%{basename:", tarbuf, "}", NULL);
++ specBase[strlen(specBase)-1] = '\0';
++ rasprintf(&specFinal, "%s/%s", specDir, specBase);
+ if (rename(specFile, specFinal)) {
+ rpmlog(RPMLOG_ERR, _("Failed to rename %s to %s: %m\n"),
+ specFile, specFinal);
+@@ -399,6 +403,7 @@ static char * getTarSpec(const char *arg)
+
+ exit:
+ free(specFile);
++ free(specDir);
+ Fclose(fd);
+ return specFinal;
+ }
+--
+2.56.0
+
diff --git a/0002-Prevent-command-injection-via-rpmbuild-t-filename.patch b/0002-Prevent-command-injection-via-rpmbuild-t-filename.patch
new file mode 100644
index 0000000..09a6b8c
--- /dev/null
+++ b/0002-Prevent-command-injection-via-rpmbuild-t-filename.patch
@@ -0,0 +1,187 @@
+From b51759c2ec195c3eaab2b0de0b7a60a4512a984e Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Mon, 7 Sep 2026 14:41:39 +0200
+Subject: [PATCH 2/3] Prevent command injection via rpmbuild -t filename
+
+Commit 2a11eb3e4e51094082e0123aebd797ec051dc094 fixed command injection
+via spec file entries, but there's another case where we pass some data
+controlled by the tarball through macro or shell expansion: the filename
+argument itself.
+
+This happens in three places during tarball decompression: the first two
+are in getTarSpec() where we construct and execute the shell command for
+spec file extraction using rpmExpand() and popen(3), respectively, which
+leads to the third one where we execute the actual decompression utility
+using popen(3) in rpmuncompress. The filename gets passed through all of
+these steps, and can cause arbitrary shell code execution in each one.
+
+Fix that by passing the filename as a positional argument when invoking
+the shell so that the command can reference it through the hardcoded $1
+parameter instead of the filename directly. Add our own popen(3) version
+for this purpose that takes an additional argument to be passed as $1 to
+the shell, to preserve the surrounding logic and keep the patch minimal.
+Hardcode /bin/sh as the shell since that's what popen(3) claims to do.
+
+Don't bother with write mode support like the original function, though,
+it can always be added later if this new version turns out to be useful
+elsewhere. Add also a pclose(3) equivalent, just for consistency, since
+the original call would probably work fine when passed the FILE stream
+created by us.
+
+Adjust the rpmuncompress output when in verbose/dry mode so that it is
+preserved exactly. That means, generate the shell command again but this
+time with the actual filename (enclosed in single quotes), and use that
+for printing. Note that this has to happen in *addition* to the default
+command that uses $1 since we need both variants when in verbose mode.
+
+Enable the tests added in the previous commit as they are now expected
+to pass.
+
+Long-term, a better solution would be to split the shell commands such
+that the simple program invocations that need the filename can be done
+with a plain fork-exec instead of popen(3), or better yet, to just port
+the internals to libarchive. But either is much more complex and would
+make the patch more difficult to backport, so let's just stick with the
+uglier fix for now.
+
+Fixes: CVE-2026-84837, CVE-2026-84838
+
+Backported from commit 7a4111bc5db4053e5381b65306903837763e7f11:
+
+- This codebase is only affected by CVE-2026-84837 (rpmbuild -ts), that
+ is, in the getTarSpec() function, since the rpmuncompress utility
+ isn't present yet.
+
+- Obtain the uncompress command line separately by using the newly added
+ rpmGetArchiver() function. This is needed in order to prevent the
+ macro injection flaw since the %{uncompress} macro also does the
+ detection (and thus requires an actual filename on disk to open),
+ unlike in the later versions where it merely expands to the
+ rpmuncompress path.
+
+- Log a warning (but don't fail) if the archiver couldn't be detected:
+ this would have previously generated an empty command when using the
+ %{uncompress} macro, so it's a nice bonus.
+---
+ cliutils.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ cliutils.h | 7 +++++++
+ rpmbuild.c | 12 +++++++++---
+ 3 files changed, 64 insertions(+), 3 deletions(-)
+
+diff --git a/cliutils.c b/cliutils.c
+index 772a105ec..2231ed1f1 100644
+--- a/cliutils.c
++++ b/cliutils.c
+@@ -86,3 +86,51 @@ int finishPipe(void)
+ }
+ return rc;
+ }
++
++FILE* rpopen(const char *cmd, const char *arg)
++{
++ FILE *stream = NULL;
++ ARGV_t argv = NULL;
++ int pipefd[2];
++ pid_t pid;
++
++ if (pipe(pipefd) < 0)
++ goto exit;
++
++ argvAdd(&argv, "/bin/sh");
++ argvAdd(&argv, "-c");
++ argvAdd(&argv, cmd);
++ argvAdd(&argv, "sh");
++ argvAdd(&argv, arg);
++
++ if ((pid = fork()) == 0) {
++ dup2(pipefd[1], STDOUT_FILENO);
++ close(pipefd[0]);
++ execv(argv[0], argv);
++ _exit(EXIT_FAILURE);
++ } else if (pid == -1) {
++ goto exit;
++ }
++
++ close(pipefd[1]);
++ stream = fdopen(pipefd[0], "r");
++
++exit:
++ argvFree(argv);
++ return stream;
++}
++
++int rpclose(FILE *stream)
++{
++ int rc = -1;
++ int status;
++
++ if ((waitpid(-1, &status, 0) == -1) || !WIFEXITED(status))
++ goto exit;
++
++ rc = WEXITSTATUS(status);
++
++exit:
++ fclose(stream);
++ return rc;
++}
+diff --git a/cliutils.h b/cliutils.h
+index b5deee1ba..cda4bebdf 100644
+--- a/cliutils.h
++++ b/cliutils.h
+@@ -22,4 +22,11 @@ int initPipe(void);
+
+ int finishPipe(void);
+
++/*
++ * A safe, read-only variant of popen(3) that passes untrusted input (arg) as a
++ * positional argument to sh(1) where the command (cmd) can read it via $1.
++ */
++FILE *rpopen(const char *cmd, const char *arg);
++int rpclose(FILE *stream);
++
+ #endif /* _CLIUTIL_H */
+diff --git a/rpmbuild.c b/rpmbuild.c
+index 8dbd06d5f..ddc1e0750 100644
+--- a/rpmbuild.c
++++ b/rpmbuild.c
+@@ -15,6 +15,7 @@
+ #include "lib/signature.h"
+ #include "cliutils.h"
+
++#include "rpmio/rpmmacro_internal.h"
+ #include "debug.h"
+
+ static struct rpmBuildArguments_s rpmBTArgs;
+@@ -353,13 +354,18 @@ static char * getTarSpec(const char *arg)
+ for (spec = tryspec; *spec != NULL; spec++) {
+ FILE *fp;
+ char *cmd;
++ const char *uncmd = NULL;
+ int specfiles = 0;
+
+- cmd = rpmExpand("%{uncompress: ", arg, "} | ",
++ if (rpmGetArchiver(arg, &uncmd))
++ rpmlog(RPMLOG_WARNING,
++ _("Failed to detect archive type: %s\n"), arg);
++
++ cmd = rpmExpand(uncmd, "\"$1\" | ",
+ "%{__tar} xOvof - --wildcards ", *spec,
+ " 2>&1 > ", specFile, NULL);
+
+- if (!(fp = popen(cmd, "r"))) {
++ if (!(fp = rpopen(cmd, arg))) {
+ rpmlog(RPMLOG_ERR, _("Failed to open tar pipe: %m\n"));
+ } else {
+ char *fok;
+@@ -372,7 +378,7 @@ static char * getTarSpec(const char *arg)
+ }
+ specfiles++;
+ }
+- pclose(fp);
++ rpclose(fp);
+ gotspec = (specfiles == 1) && isSpecFile(specFile);
+ if (specfiles > 1) {
+ rpmlog(RPMLOG_ERR, _("Found more than one spec file in %s\n"), arg);
+--
+2.56.0
+
diff --git a/0003-Add-a-variable-argument-list-to-rpopen.patch b/0003-Add-a-variable-argument-list-to-rpopen.patch
new file mode 100644
index 0000000..19a5b98
--- /dev/null
+++ b/0003-Add-a-variable-argument-list-to-rpopen.patch
@@ -0,0 +1,82 @@
+From b0ed834235f910a5b7ebe56daa6e0e034bb41349 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Thu, 22 Oct 2026 09:11:51 +0200
+Subject: [PATCH 3/3] Add a variable argument list to rpopen()
+
+Accept multiple positional arguments for the shell instead of just one.
+This will be needed in the next commits.
+
+No functional change.
+
+Backported from commit e7a086a8e203f123fbd37ead9b52188d1302ce0e.
+---
+ cliutils.c | 9 +++++++--
+ cliutils.h | 7 ++++---
+ rpmbuild.c | 2 +-
+ 3 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/cliutils.c b/cliutils.c
+index 2231ed1f1..6547e7bdb 100644
+--- a/cliutils.c
++++ b/cliutils.c
+@@ -87,10 +87,11 @@ int finishPipe(void)
+ return rc;
+ }
+
+-FILE* rpopen(const char *cmd, const char *arg)
++FILE* rpopen(const char *cmd, const char *arg, ...)
+ {
+ FILE *stream = NULL;
+ ARGV_t argv = NULL;
++ va_list ap;
+ int pipefd[2];
+ pid_t pid;
+
+@@ -101,7 +102,11 @@ FILE* rpopen(const char *cmd, const char *arg)
+ argvAdd(&argv, "-c");
+ argvAdd(&argv, cmd);
+ argvAdd(&argv, "sh");
+- argvAdd(&argv, arg);
++
++ va_start(ap, arg);
++ for (const char *s = arg; s != NULL; s = va_arg(ap, const char *))
++ argvAdd(&argv, s);
++ va_end(ap);
+
+ if ((pid = fork()) == 0) {
+ dup2(pipefd[1], STDOUT_FILENO);
+diff --git a/cliutils.h b/cliutils.h
+index cda4bebdf..4aee1ae72 100644
+--- a/cliutils.h
++++ b/cliutils.h
+@@ -23,10 +23,11 @@ int initPipe(void);
+ int finishPipe(void);
+
+ /*
+- * A safe, read-only variant of popen(3) that passes untrusted input (arg) as a
+- * positional argument to sh(1) where the command (cmd) can read it via $1.
++ * A safe, read-only variant of popen(3) that passes untrusted input (args) as
++ * positional arguments to sh(1) where the command (cmd) can read them via $1,
++ * $2, and so on.
+ */
+-FILE *rpopen(const char *cmd, const char *arg);
++FILE *rpopen(const char *cmd, const char *arg, ...) RPM_GNUC_NULL_TERMINATED;
+ int rpclose(FILE *stream);
+
+ #endif /* _CLIUTIL_H */
+diff --git a/rpmbuild.c b/rpmbuild.c
+index ddc1e0750..63872325d 100644
+--- a/rpmbuild.c
++++ b/rpmbuild.c
+@@ -365,7 +365,7 @@ static char * getTarSpec(const char *arg)
+ "%{__tar} xOvof - --wildcards ", *spec,
+ " 2>&1 > ", specFile, NULL);
+
+- if (!(fp = rpopen(cmd, arg))) {
++ if (!(fp = rpopen(cmd, arg, NULL))) {
+ rpmlog(RPMLOG_ERR, _("Failed to open tar pipe: %m\n"));
+ } else {
+ char *fok;
+--
+2.56.0
+
diff --git a/python3-rpm.spec b/python3-rpm.spec
index 7330b95..d5d690e 100644
--- a/python3-rpm.spec
+++ b/python3-rpm.spec
@@ -31,14 +31,14 @@
%global rpmver 4.16.1.3
#global snapver rc1
-%global rel 40
+%global rel 43
%global sover 9
%global rhelrel %{?snapver:0.%{snapver}.}%{rel}
%global rel_next %{lua:print(tonumber(rpm.expand("%rel")) + 1)}
%global rhelrel_next %{?snapver:0.%{snapver}.}%{rel_next}
# Bump this for EPEL only rebuilds, reset when %%rel was bumped
-%global baserelease 2
+%global baserelease 1
%global srcver %{rpmver}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:rpm-%(echo %{rpmver} | cut -d'.' -f1-2).x}
@@ -128,6 +128,11 @@ Patch154: 0003-Add-support-for-spec-local-file-attributes-and-gener.patch
Patch155: 0001-Allow-an-optional-override-clock-for-deterministic-t.patch
Patch156: 0001-Improve-error-handling-on-keystore-load.patch
Patch157: 0001-Sort-files-before-passing-to-file-attribute-dependen.patch
+Patch158: 0001-Prevent-command-injection-via-rpmbuild-t.patch
+Patch159: 0001-Extract-archiver-detection-out-of-doUncompress.patch
+Patch160: 0002-Prevent-command-injection-via-rpmbuild-t-filename.patch
+Patch161: 0003-Add-a-variable-argument-list-to-rpopen.patch
+Patch162: 0001-Fix-rpopen-rpclose-and-make-them-more-POSIXy.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -427,6 +432,15 @@ make clean
%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
%changelog
+* Mon Nov 09 2026 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-43
+- Fix rpopen()/rpclose() and make them more POSIXy (RHEL-288157)
+
+* Mon Oct 26 2026 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-42
+- CVE-2026-84837: Prevent command injection via rpmbuild -t filename (RHEL-288157)
+
+* Tue Oct 13 2026 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-41
+- CVE-2026-78367: Prevent command injection via rpmbuild -t (RHEL-282745)
+
* Tue Mar 17 2026 Miro Hrončok <mhroncok@redhat.com> - 4.16.1.3-40.2
- Add python3.14-rpm
next reply other threads:[~2026-11-13 18:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 18:33 [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-06-04 15:28 [rpms/python3-rpm] epel9: Merge epel9-next into epel9
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=179459481452.1.14802351525178978068.rpms-python3-rpm-d5003bf3a04d@fedoraproject.org \
--to=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