public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
@ 2026-11-13 19:46
0 siblings, 0 replies; 6+ messages in thread
From: @ 2026-11-13 19:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9-next
Commit : 92076f7f6719f868aa05f7887bf766afcaabe29a
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2024-05-01T22:11:14+02:00
Stats : +272/-10 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/python3-rpm/c/92076f7f6719f868aa05f7887bf766afcaabe29a?branch=epel9-next
Log:
Merge epel9-next into epel9
---
diff --git a/0001-Expose-and-document-rpmdb-verifydb-operation.patch b/0001-Expose-and-document-rpmdb-verifydb-operation.patch
new file mode 100644
index 0000000..23b444a
--- /dev/null
+++ b/0001-Expose-and-document-rpmdb-verifydb-operation.patch
@@ -0,0 +1,148 @@
+From 173b737f40e7da85f79544e3f4ea4ad7b8f7d5c2 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 6 Nov 2023 15:58:54 +0200
+Subject: [PATCH] Expose and document rpmdb --verifydb operation
+
+After years of BDB, sometimes folks just want some assurance that their db
+is still fine. Properly exposing an operation to do so hopefully makes
+less likely to poke at the db directly (with eg sqlite3 command).
+---
+ docs/man/rpmdb.8.md | 4 ++++
+ tools/rpmdb.c | 4 ++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/rpmdb.c b/rpmdb.c
+index 22b0b3e5d..36efff8af 100644
+--- a/rpmdb.c
++++ b/rpmdb.c
+@@ -23,8 +23,8 @@ static struct poptOption dbOptsTable[] = {
+ { "rebuilddb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_REBUILDDB,
+ N_("rebuild database inverted lists from installed package headers"),
+ NULL},
+- { "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
+- &mode, MODE_VERIFYDB, N_("verify database files"), NULL},
++ { "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR),
++ &mode, MODE_VERIFYDB, N_("verify database"), NULL},
+ { "salvagedb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
+ &mode, MODE_SALVAGEDB, N_("salvage database"), NULL},
+ { "exportdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_EXPORTDB,
+--
+2.41.0
+
+--- a/doc/rpmdb.8 2020-05-28 12:04:25.024136615 +0200
++++ b/doc/rpmdb.8 2023-12-13 11:57:30.646202901 +0100
+@@ -1,48 +1,70 @@
+-.TH "RPMDB" "8" "29 June 2010" "Red Hat, Inc"
++.\" Automatically generated by Pandoc 3.1.3
++.\"
++.\" Define V font for inline verbatim, using C font in formats
++.\" that render this, and otherwise B font.
++.ie "\f[CB]x\f[]"x" \{\
++. ftr V B
++. ftr VI BI
++. ftr VB B
++. ftr VBI BI
++.\}
++.el \{\
++. ftr V CR
++. ftr VI CI
++. ftr VB CB
++. ftr VBI CBI
++.\}
++.TH "RPMDB" "8" "29 June 2010" "" ""
++.hy
+ .SH NAME
+-rpmdb \- RPM Database Tool
++.PP
++rpmdb - RPM Database Tool
+ .SH SYNOPSIS
+-
+-\fBrpm\fR {\fB--initdb|--rebuilddb\fR}
+-
+-.SH "DESCRIPTION"
+-The general form of an rpm rebuild database command is
+-.PP
+-
+-\fBrpm\fR {\fB--initdb|--rebuilddb\fR} [\fB-v\fR] [\fB--dbpath \fIDIRECTORY\fB\fR] [\fB--root \fIDIRECTORY\fB\fR]
+-
+-.PP
+-Use \fB--initdb\fR to create a new database if one doesn't already exist
+-(existing database is not overwritten), use
+-\fB--rebuilddb\fR to rebuild the database indices from
+-the installed package headers.
+-.PP
+-
+-.SH "SEE ALSO"
+-
+-.nf
+-\fBpopt\fR(3),
+-\fBrpm\fR(8),
+-\fBrpmkeys\fR(8),
+-\fBrpmsign\fR(8),
+-\fBrpm2cpio\fR(8),
+-\fBrpmbuild\fR(8),
+-\fBrpmspec\fR(8),
+-.fi
+-
+-\fBrpm --help\fR - as rpm supports customizing the options via popt aliases
+-it's impossible to guarantee that what's described in the manual matches
+-what's available.
+-
+-
+-\fBhttp://www.rpm.org/ <URL:http://www.rpm.org/>
+-\fR
+-.SH "AUTHORS"
+-
++.PP
++\f[B]rpmdb\f[R] {\f[B]--initdb|--rebuilddb\f[R]}
++.PP
++\f[B]rpmdb\f[R] {\f[B]--verifydb\f[R]}
++.PP
++\f[B]rpmdb\f[R] {\f[B]--exportdb|--importdb\f[R]}
++.SH DESCRIPTION
++.PP
++The general form of an rpmdb command is
++.PP
++\f[B]rpm\f[R] {\f[B]--initdb|--rebuilddb\f[R]} [\f[B]-v\f[R]]
++[\f[B]--dbpath \f[R]\f[I]DIRECTORY\f[R]] [\f[B]--root
++\f[R]\f[I]DIRECTORY\f[R]]
++.PP
++Use \f[B]--initdb\f[R] to create a new database if one doesn\[aq]t
++already exist (existing database is not overwritten), use
++\f[B]--rebuilddb\f[R] to rebuild the database indices from the installed
++package headers.
++.PP
++\f[B]--verifydb\f[R] performs a low-level integrity check on the
++database.
++.PP
++\f[B]--exportdb\f[R] exports the database in header-list format,
++suitable for transfporting to another host or database type.
++.PP
++\f[B]--importdb\f[R] imports a database from a header-list format as
++created by \f[B]--exportdb\f[R].
++.SH SEE ALSO
++.PP
++\f[B]popt\f[R](3), \f[B]rpm\f[R](8), \f[B]rpmkeys\f[R](8),
++\f[B]rpmsign\f[R](8), \f[B]rpm2cpio\f[R](8), \f[B]rpmbuild\f[R](8),
++\f[B]rpmspec\f[R](8)
++.PP
++\f[B]rpm --help\f[R] - as rpm supports customizing the options via popt
++aliases it\[aq]s impossible to guarantee that what\[aq]s described in
++the manual matches what\[aq]s available.
++.PP
++\f[B]http://www.rpm.org/ <URL:http://www.rpm.org/>\f[R]
++.SH AUTHORS
++.IP
+ .nf
+-Marc Ewing <marc@redhat.com>
+-Jeff Johnson <jbj@redhat.com>
+-Erik Troan <ewt@redhat.com>
+-Panu Matilainen <pmatilai@redhat.com>
++\f[C]
++Marc Ewing <marc\[at]redhat.com>
++Jeff Johnson <jbj\[at]redhat.com>
++Erik Troan <ewt\[at]redhat.com>
++Panu Matilainen <pmatilai\[at]redhat.com>
++\f[R]
+ .fi
+-
diff --git a/0001-Fix-a-copy-paste-help-description-of-whatconflicts-R.patch b/0001-Fix-a-copy-paste-help-description-of-whatconflicts-R.patch
new file mode 100644
index 0000000..63cc183
--- /dev/null
+++ b/0001-Fix-a-copy-paste-help-description-of-whatconflicts-R.patch
@@ -0,0 +1,26 @@
+From 03525592c944957f3b7b200b7daeb9f615cdcde7 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Tue, 23 May 2023 12:46:22 +0300
+Subject: [PATCH] Fix a copy-paste --help description of --whatconflicts
+ (RhBug:2208661)
+
+---
+ lib/poptQV.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/poptQV.c b/lib/poptQV.c
+index ac8e8975d..8bd91c652 100644
+--- a/lib/poptQV.c
++++ b/lib/poptQV.c
+@@ -108,7 +108,7 @@ struct poptOption rpmQVSourcePoptTable[] = {
+ { "verify", 'V', POPT_ARGFLAG_DOC_HIDDEN, NULL, 'V',
+ N_("rpm verify mode"), NULL },
+ { "whatconflicts", '\0', 0, 0, POPT_WHATCONFLICTS,
+- N_("query/verify the package(s) which require a dependency"), "CAPABILITY" },
++ N_("query/verify the package(s) which conflict with a dependency"), "CAPABILITY" },
+ { "whatrequires", '\0', 0, 0, POPT_WHATREQUIRES,
+ N_("query/verify the package(s) which require a dependency"), "CAPABILITY" },
+ { "whatobsoletes", '\0', 0, 0, POPT_WHATOBSOLETES,
+--
+2.41.0
+
diff --git a/0001-Fix-short-circuiting-of-version-strings-in-expressio.patch b/0001-Fix-short-circuiting-of-version-strings-in-expressio.patch
new file mode 100644
index 0000000..e06709a
--- /dev/null
+++ b/0001-Fix-short-circuiting-of-version-strings-in-expressio.patch
@@ -0,0 +1,50 @@
+From 321933f060896f721e361a1c8a8d3731bdcee827 Mon Sep 17 00:00:00 2001
+From: Michael Schroeder <mls@suse.de>
+Date: Wed, 22 Jun 2022 14:07:01 +0200
+Subject: [PATCH] Fix short circuiting of version strings in expressions
+
+We use an empty string when discarding a value due to short circuiting, but
+an empty string is not allowed for versions. So use "0" in that case.
+
+Fixes: #1883
+---
+ rpmio/expression.c | 2 +-
+ tests/rpmmacro.at | 2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/rpmio/expression.c b/rpmio/expression.c
+index a389a04d5..98a44bbdb 100644
+--- a/rpmio/expression.c
++++ b/rpmio/expression.c
+@@ -477,7 +477,7 @@ static int rdToken(ParseState state)
+ if (qtok == TOK_STRING) {
+ v = valueMakeString(temp);
+ } else {
+- v = valueMakeVersion(temp);
++ v = valueMakeVersion(state->flags & RPMEXPR_DISCARD ? "0" : temp);
+ free(temp); /* version doesn't take ownership of the string */
+ if (v == 0) {
+ exprErr(state, _("invalid version"), p+1);
+diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at
+index d1490b4d9..c4376d49e 100644
+--- a/tests/rpmmacro.at
++++ b/tests/rpmmacro.at
+@@ -533,6 +533,7 @@ runroot rpm \
+ --eval '%["%{aaa}"]' \
+ --eval '%[%{?ccc}]' \
+ --eval '%[v"1:2.3-4"]' \
++ --eval '%[v"0" && v"0"]' \
+ ]],
+ [0],
+ [4096
+@@ -542,6 +543,7 @@ runroot rpm \
+ 5
+ 0
+ 1:2.3-4
++0
+ ],
+ [])
+ AT_CLEANUP
+--
+2.41.0
+
diff --git a/python3-rpm.spec b/python3-rpm.spec
index b501e7c..3346a38 100644
--- a/python3-rpm.spec
+++ b/python3-rpm.spec
@@ -1,8 +1,3 @@
-# We'll build python3.11-rpm only for now
-# Once a new Python version is added,
-# the spec will need to change to support multiple Pythons anyway
-%global python3_pkgversion 3.11
-
# run internal testsuite?
# fakechroot is severely broken beyond fedora 33, disable...
%if 0%{?fedora} > 33 || 0%{?rhel} > 8
@@ -36,14 +31,14 @@
%global rpmver 4.16.1.3
#global snapver rc1
-%global rel 27
+%global rel 29
%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 1
+%global baserelease 2
%global srcver %{rpmver}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:rpm-%(echo %{rpmver} | cut -d'.' -f1-2).x}
@@ -115,6 +110,10 @@ Patch132: 0001-Fix-wrong-return-code-on-O_DIRECTORY-open-of-invalid.patch
Patch133: 0001-Print-full-path-if-file-removal-fails.patch
Patch134: 0001-Don-t-warn-about-missing-user-group-on-skipped-files.patch
+Patch140: 0001-Fix-short-circuiting-of-version-strings-in-expressio.patch
+Patch141: 0001-Fix-a-copy-paste-help-description-of-whatconflicts-R.patch
+Patch142: 0001-Expose-and-document-rpmdb-verifydb-operation.patch
+
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
# Probably to be upstreamed in slightly different form
@@ -199,9 +198,12 @@ BuildRequires: ima-evm-utils-devel >= 1.0
%description
Additional Python 3.X packages with the RPM Python bindings.
-%package -n python%{python3_pkgversion}-rpm
+%define python3x_package %{?name:%package -n python%{python3_pkgversion}-rpm
Summary: Python %{python3_pkgversion} bindings for apps which will manipulate RPM packages
BuildRequires: python%{python3_pkgversion}-devel
+%if v"%{python3_pkgversion}" >= v"3.12"
+BuildRequires: python%{python3_pkgversion}-setuptools
+%endif
Requires: (rpm-libs%{?_isa} >= %{version}-%{rhelrel} with rpm-libs%{?_isa} < %{version}-%{rhelrel_next})
%description -n python%{python3_pkgversion}-rpm
@@ -210,7 +212,12 @@ written in the Python programming language to use the interface
supplied by RPM Package Manager libraries.
This package should be installed if you want to develop Python %{python3_pkgversion}
-programs that will manipulate RPM packages and databases.
+programs that will manipulate RPM packages and databases.}
+
+%global python3_pkgversion 3.11
+%python3x_package
+%global python3_pkgversion 3.12
+%python3x_package
%prep
%autosetup -n rpm-%{srcver} %{?with_int_bdb:-a 1} -p1
@@ -269,6 +276,9 @@ export PYTHON=%{python3}
%make_build
pushd python
+%global python3_pkgversion 3.11
+%py3_build
+%global python3_pkgversion 3.12
%py3_build
popd
@@ -278,6 +288,9 @@ popd
# We need to build with --enable-python for the self-test suite, but we
# actually package the bindings built with setup.py (#531543#c26)
pushd python
+%global python3_pkgversion 3.11
+%py3_install
+%global python3_pkgversion 3.12
%py3_install
popd
@@ -340,6 +353,9 @@ rm -r %{buildroot}%{_prefix}/lib
rm -r %{buildroot}%{_sysconfdir}
%check
+%global python3_pkgversion 3.11
+%py3_check_import rpm rpm.transaction
+%global python3_pkgversion 3.12
%py3_check_import rpm rpm.transaction
%if %{with check}
make check TESTSUITEFLAGS=-j%{_smp_build_ncpus} || (cat tests/rpmtests.log; exit 1)
@@ -347,14 +363,36 @@ make check TESTSUITEFLAGS=-j%{_smp_build_ncpus} || (cat tests/rpmtests.log; exit
make clean
%endif
+%global python3_pkgversion 3.11
%files -n python%{python3_pkgversion}-rpm
%license COPYING
%{python3_sitearch}/rpm/
%{python3_sitearch}/rpm-%{rpmver}*.egg-info
+%global python3_pkgversion 3.12
+%files -n python%{python3_pkgversion}-rpm
+%license COPYING
+%{python3_sitearch}/rpm/
+%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
+
%changelog
+* Mon Jan 29 2024 Miro Hrončok <mhroncok@redhat.com> - 4.16.1.3-29.2
+- Add python3.12-rpm
+
+* Wed Dec 13 2023 Florian Festi <ffesti@redhat.com> - 4.16.1.3-29
+- Actually add --verifydb to the man page (RHEL-14591)
+- Don't warn about missing user/group on skipped files (RHEL-18037)
+
+* Mon Dec 11 2023 Florian Festi <ffesti@redhat.com> - 4.16.1.3-28
+- Fix warning if file removal fails
+
+* Mon Nov 27 2023 Florian Festi <ffesti@redhat.com> - 4.16.1.3-27
+- Fix short circuiting of version strings in expressions (RHEL-15688)
+- Fix description of whatconflicts in the man page (RHEL-6303)
+- Expose and document rpmdb --verifydb operation (RHEL-14591)
+- Fixes to the file handling backport
-* Mon Dec 11 2023 Florian Festi <ffesti@redhat.com> - 4.16.1.3-27
+* Fri Nov 10 2023 Florian Festi <ffesti@redhat.com> - 4.16.1.3-26
- Backport file handling code from rpm-4.19 to fix CVE-2021-35937,
CVE-2021-35938 and CVE-2021-35939
^ permalink raw reply related [flat|nested] 6+ messages in thread* [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
@ 2026-11-13 19:46
0 siblings, 0 replies; 6+ messages in thread
From: @ 2026-11-13 19:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9-next
Commit : 576fe28657b9c224e94ebd152c2c24978cadc394
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2025-07-03T13:38:59+02:00
Stats : +658/-3 in 7 file(s)
URL : https://src.fedoraproject.org/rpms/python3-rpm/c/576fe28657b9c224e94ebd152c2c24978cadc394?branch=epel9-next
Log:
Merge epel9-next into epel9
---
diff --git a/0001-Allow-parametric-macros-to-opt-out-of-option-process.patch b/0001-Allow-parametric-macros-to-opt-out-of-option-process.patch
new file mode 100644
index 0000000..52723c3
--- /dev/null
+++ b/0001-Allow-parametric-macros-to-opt-out-of-option-process.patch
@@ -0,0 +1,92 @@
+From 1f9a0e049e2db70e6fc6d630fa3c63f57517dea4 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Fri, 9 Oct 2020 14:43:14 +0300
+Subject: [PATCH] Allow parametric macros to opt out of option processing
+ (#547)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Macros might want to pass along options meant for others while perhaps
+modifying some of them, without exposing it all to users.
+
+Have "-" as the parametric macro opts string disable all options processing
+in rpm, allowing the macro to handle the raw argument list as they place.
+
+Fixes: #547
+
+(cherry picked from commit f9516434dd70cf0d5125e9e997b2c278b4fb4bf2)
+
+Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
+---
+ doc/manual/macros | 3 ++-
+ rpmio/macro.c | 7 ++++++-
+ tests/rpmmacro.at | 12 ++++++++++++
+ 3 files changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/doc/manual/macros b/doc/manual/macros
+index 45345d036..a33c54e03 100644
+--- a/doc/manual/macros
++++ b/doc/manual/macros
+@@ -22,7 +22,8 @@ All whitespace surrounding \<body\> is removed. Name may be composed
+ of alphanumeric characters, and the character `_' and must be at least
+ 3 characters in length. A macro without an (opts) field is "simple" in that
+ only recursive macro expansion is performed. A parameterized macro contains
+-an (opts) field. The opts (i.e. string between parentheses) is passed
++an (opts) field. "-" as opts disables all option processing, otherwise
++the opts (i.e. string between parentheses) are passed
+ exactly as is to getopt(3) for argc/argv processing at the beginning of
+ a macro invocation. While a parameterized macro is being expanded, the
+ following shell-like macros are available:
+diff --git a/rpmio/macro.c b/rpmio/macro.c
+index 35d896049..490bf9a6a 100644
+--- a/rpmio/macro.c
++++ b/rpmio/macro.c
+@@ -910,6 +910,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
+ ARGV_t argv = NULL;
+ int argc = 0;
+ int c;
++ int run;
+
+ /*
+ * Prepare list of call arguments, starting with macro name as argv[0].
+@@ -960,8 +961,12 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
+ opts = me->opts;
+ argc = argvCount(argv);
+
++ /* If option processing is disabled, the while below will be skipped */
++ run = strcmp(opts, "-");
++ if (!run)
++ optind = 1;
+ /* Define option macros. */
+- while ((c = getopt(argc, argv, opts)) != -1)
++ while (run && (c = getopt(argc, argv, opts)) != -1)
+ {
+ char *name = NULL, *body = NULL;
+ if (c == '?' || strchr(opts, c) == NULL) {
+diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at
+index 873783153..faafb170d 100644
+--- a/tests/rpmmacro.at
++++ b/tests/rpmmacro.at
+@@ -198,6 +198,18 @@ bar' \
+ ])
+ AT_CLEANUP
+
++AT_SETUP([parametrized macro 6])
++AT_KEYWORDS([macros])
++AT_CHECK([
++runroot rpm \
++ --define '%foo(-) %{*}' \
++ --eval '%foo 5 a -z -b2'
++],
++[0],
++[5 a -z -b2
++])
++AT_CLEANUP
++
+ AT_SETUP([uncompress macro 1])
+ AT_KEYWORDS([macros])
+ AT_CHECK([
+--
+2.47.1
+
diff --git a/0001-Replace-uses-of-deprecated-PyEval_CallObject-with-Py.patch b/0001-Replace-uses-of-deprecated-PyEval_CallObject-with-Py.patch
new file mode 100644
index 0000000..0d113c0
--- /dev/null
+++ b/0001-Replace-uses-of-deprecated-PyEval_CallObject-with-Py.patch
@@ -0,0 +1,37 @@
+From 9ef1e790602622ab7d5e3b680b105958ee0199e7 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Wed, 28 Oct 2020 09:09:47 +0200
+Subject: [PATCH] Replace uses of deprecated PyEval_CallObject() with
+ PyObject_Call()
+
+Python 3.9 has deprecated PyEval_CallObject(), replace with a more
+modern and documented interface (https://bugs.python.org/issue29548).
+---
+ 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 c2a4150..fa09220 100644
+--- a/python/rpmts-py.c
++++ b/python/rpmts-py.c
+@@ -244,7 +244,7 @@ rpmts_SolveCallback(rpmts ts, rpmds ds, const void * data)
+ args = Py_BuildValue("(OiNNi)", cbInfo->tso,
+ rpmdsTagN(ds), utf8FromString(rpmdsN(ds)),
+ utf8FromString(rpmdsEVR(ds)), rpmdsFlags(ds));
+- result = PyEval_CallObject(cbInfo->cb, args);
++ result = PyObject_Call(cbInfo->cb, args, NULL);
+ Py_DECREF(args);
+
+ if (!result) {
+@@ -536,7 +536,7 @@ rpmtsCallback(const void * hd, const rpmCallbackType what,
+ Py_INCREF(pkgObj);
+
+ args = Py_BuildValue("(iLLOO)", what, amount, total, pkgObj, cbInfo->data);
+- result = PyEval_CallObject(cbInfo->cb, args);
++ result = PyObject_Call(cbInfo->cb, args, NULL);
+ Py_DECREF(args);
+ Py_DECREF(pkgObj);
+
+--
+2.50.0
+
diff --git a/0001-Report-unsafe-symlinks-during-installation-as-a-spec.patch b/0001-Report-unsafe-symlinks-during-installation-as-a-spec.patch
new file mode 100644
index 0000000..3da0ec0
--- /dev/null
+++ b/0001-Report-unsafe-symlinks-during-installation-as-a-spec.patch
@@ -0,0 +1,215 @@
+From fb192da52f3f390793dbaffe66c6148f497a8023 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 19 Aug 2024 11:03:10 +0300
+Subject: [PATCH 1/2] Report unsafe symlinks during installation as a specific
+ case
+
+RPM refuses to follow non root owned symlinks pointing to files owned by
+another user for security reasons. This case was lumped in with
+O_DIRECTORY behavior, leading to confusing error message as the symlink
+often indeed points at a directory. Emit a more meaningful error message
+when encountering unsafe symlinks.
+
+We already detect the error condition in the main if block here, might
+as well set the error code right there and then so we don't need to
+redetect later. We previously only tested for the unsafe link condition
+when our O_DIRECTORY equivalent was set, but that seems wrong. Probably
+doesn't matter with the existing callers, but we really must not
+follow those unsafe symlinks no matter what.
+
+Co-authored-by: Florian Festi <ffesti@redhat.com>
+
+Backported from commits:
+14516542c113560dc0070df2f9102568a7a71b58
+535eacc96ae6fe5289a2917bb0af43e491b0f4f4
+
+Tests are excluded from this backport since they would need significant
+rework, the use case will be covered by Beaker.
+
+Fixes: RHEL-33393
+---
+ lib/fsm.c | 70 +++++++++++++++++++++++++++--------------------------
+ lib/rpmfi.c | 1 +
+ 2 files changed, 37 insertions(+), 34 deletions(-)
+
+diff --git a/lib/fsm.c b/lib/fsm.c
+index 9dd50b784..720d4a2ec 100644
+--- a/lib/fsm.c
++++ b/lib/fsm.c
+@@ -65,7 +65,7 @@ struct filedata_s {
+ * things around needlessly
+ */
+ static const char * fileActionString(rpmFileAction a);
+-static int fsmOpenat(int dirfd, const char *path, int flags, int dir);
++static int fsmOpenat(int *fdp, int dirfd, const char *path, int flags, int dir);
+ static int fsmClose(int *wfdp);
+
+ /** \ingroup payload
+@@ -98,9 +98,9 @@ static int fsmLink(int odirfd, const char *opath, int dirfd, const char *path)
+ #ifdef WITH_CAP
+ static int cap_set_fileat(int dirfd, const char *path, cap_t fcaps)
+ {
+- int rc = -1;
+- int fd = fsmOpenat(dirfd, path, O_RDONLY|O_NOFOLLOW, 0);
+- if (fd >= 0) {
++ int fd = -1;
++ int rc = fsmOpenat(&fd, dirfd, path, O_RDONLY|O_NOFOLLOW, 0);
++ if (!rc) {
+ rc = cap_set_fd(fd, fcaps);
+ fsmClose(&fd);
+ }
+@@ -299,12 +299,12 @@ static int fsmMkdir(int dirfd, const char *path, mode_t mode)
+ return rc;
+ }
+
+-static int fsmOpenat(int dirfd, const char *path, int flags, int dir)
++static int fsmOpenat(int *wfdp, int dirfd, const char *path, int flags, int dir)
+ {
+ struct stat lsb, sb;
+ int sflags = flags | O_NOFOLLOW;
+ int fd = openat(dirfd, path, sflags);
+- int ffd = fd;
++ int rc = 0;
+
+ /*
+ * Only ever follow symlinks by root or target owner. Since we can't
+@@ -313,7 +313,7 @@ static int fsmOpenat(int dirfd, const char *path, int flags, int dir)
+ * it could've only been the link owner or root.
+ */
+ if (fd < 0 && errno == ELOOP && flags != sflags) {
+- ffd = openat(dirfd, path, flags);
++ int ffd = openat(dirfd, path, flags);
+ if (ffd >= 0) {
+ if (fstatat(dirfd, path, &lsb, AT_SYMLINK_NOFOLLOW) == 0) {
+ if (fstat(ffd, &sb) == 0) {
+@@ -322,17 +322,26 @@ static int fsmOpenat(int dirfd, const char *path, int flags, int dir)
+ }
+ }
+ }
+- if (ffd != fd)
++ /* Symlink with non-matching owners */
++ if (ffd != fd) {
+ close(ffd);
++ rc = RPMERR_INVALID_SYMLINK;
++ }
+ }
+ }
+
+ /* O_DIRECTORY equivalent */
+- if (dir && ((fd != ffd) || (fd >= 0 && fstat(fd, &sb) == 0 && !S_ISDIR(sb.st_mode)))) {
+- errno = ENOTDIR;
++ if (!rc && dir && fd >= 0 && fstat(fd, &sb) == 0 && !S_ISDIR(sb.st_mode))
++ rc = RPMERR_ENOTDIR;
++
++ if (!rc && fd < 0)
++ rc = RPMERR_OPEN_FAILED;
++
++ if (rc)
+ fsmClose(&fd);
+- }
+- return fd;
++
++ *wfdp = fd;
++ return rc;
+ }
+
+ static int fsmDoMkDir(rpmPlugins plugins, int dirfd, const char *dn,
+@@ -351,9 +360,7 @@ static int fsmDoMkDir(rpmPlugins plugins, int dirfd, const char *dn,
+ rc = fsmMkdir(dirfd, dn, mode);
+
+ if (!rc) {
+- *fdp = fsmOpenat(dirfd, dn, O_RDONLY|O_NOFOLLOW, 1);
+- if (*fdp == -1)
+- rc = RPMERR_ENOTDIR;
++ rc = fsmOpenat(fdp, dirfd, dn, O_RDONLY|O_NOFOLLOW, 1);
+ }
+
+ if (!rc) {
+@@ -378,47 +385,44 @@ static int ensureDir(rpmPlugins plugins, const char *p, int owned, int create,
+ char *sp = NULL, *bn;
+ char *apath = NULL;
+ int oflags = O_RDONLY;
+- int rc = 0;
+
+ if (*dirfdp >= 0)
+- return rc;
++ return 0;
+
+- int dirfd = fsmOpenat(-1, "/", oflags, 1);
++ int dirfd = -1;
++ int rc = fsmOpenat(&dirfd, -1, "/", oflags, 1);
+ int fd = dirfd; /* special case of "/" */
+
+ char *path = xstrdup(p);
+ char *dp = path;
+
+ while ((bn = strtok_r(dp, "/", &sp)) != NULL) {
+- fd = fsmOpenat(dirfd, bn, oflags, 1);
++ rc = fsmOpenat(&fd, dirfd, bn, oflags, 1);
+ /* assemble absolute path for plugins benefit, sigh */
+ apath = rstrscat(&apath, "/", bn, NULL);
+
+- if (fd < 0 && errno == ENOENT && create) {
++ if (rc && errno == ENOENT && create) {
+ mode_t mode = S_IFDIR | (_dirPerms & 07777);
+ rc = fsmDoMkDir(plugins, dirfd, bn, apath, owned, mode, &fd);
+ }
+
+ fsmClose(&dirfd);
+- if (fd >= 0) {
+- dirfd = fd;
+- } else {
+- if (!quiet) {
+- rpmlog(RPMLOG_ERR, _("failed to open dir %s of %s: %s\n"),
+- bn, p, strerror(errno));
+- }
+- rc = RPMERR_OPEN_FAILED;
++ if (rc)
+ break;
+- }
+
++ dirfd = fd;
+ dp = NULL;
+ }
+
+ if (rc) {
++ if (!quiet) {
++ char *msg = rpmfileStrerror(rc);
++ rpmlog(RPMLOG_ERR, _("failed to open dir %s of %s: %s\n"),
++ bn, p, msg);
++ free(msg);
++ }
+ fsmClose(&fd);
+ fsmClose(&dirfd);
+- } else {
+- rc = 0;
+ }
+ *dirfdp = dirfd;
+
+@@ -1025,10 +1029,8 @@ setmeta:
+ /* Only follow safe symlinks, and never on temporary files */
+ if (fp->suffix)
+ flags |= AT_SYMLINK_NOFOLLOW;
+- fd = fsmOpenat(di.dirfd, fp->fpath, flags,
++ rc = fsmOpenat(&fd, di.dirfd, fp->fpath, flags,
+ S_ISDIR(fp->sb.st_mode));
+- if (fd < 0)
+- rc = RPMERR_OPEN_FAILED;
+ }
+
+ if (!rc && fp->setmeta) {
+diff --git a/lib/rpmfi.c b/lib/rpmfi.c
+index b5223a43f..e8e3ea294 100644
+--- a/lib/rpmfi.c
++++ b/lib/rpmfi.c
+@@ -2436,6 +2436,7 @@ char * rpmfileStrerror(int rc)
+ case RPMERR_DIGEST_MISMATCH: s = _("Digest mismatch"); break;
+ case RPMERR_INTERNAL: s = _("Internal error"); break;
+ case RPMERR_UNMAPPED_FILE: s = _("Archive file not in header"); break;
++ case RPMERR_INVALID_SYMLINK: s = _("Unsafe symlink"); break;
+ case RPMERR_ENOENT: s = strerror(ENOENT); break;
+ case RPMERR_ENOTEMPTY: s = strerror(ENOTEMPTY); break;
+ case RPMERR_EXIST_AS_DIR:
+--
+2.47.1
+
diff --git a/0002-Fix-FA_TOUCH-ed-files-getting-removed-on-failed-upda.patch b/0002-Fix-FA_TOUCH-ed-files-getting-removed-on-failed-upda.patch
new file mode 100644
index 0000000..a690b52
--- /dev/null
+++ b/0002-Fix-FA_TOUCH-ed-files-getting-removed-on-failed-upda.patch
@@ -0,0 +1,46 @@
+From 9eedcd6b770154a8d853db30b49d411823d64c44 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Fri, 18 Oct 2024 14:50:35 +0300
+Subject: [PATCH 2/2] Fix FA_TOUCH'ed files getting removed on failed update
+
+On install/update, most files are laid down with a temporary suffix
+and if the update fails, removing those at the end of the loop is
+the right thing to do. However FA_TOUCH'ed files were already there,
+we only update their metadata, and we better not remove them!
+
+AFAICS this all versions since rpm >= 4.14 in one way or the other.
+If %_minimize_writes is enabled then it affects way more than just
+unmodified config files.
+
+The test is a simplified version of pam update failing in the original
+report. Technically, --nomtime should not be needed for the test
+verification but we don't even try to restore the metadata on failure,
+and fixing that is way out of scope here.
+
+Backported from commits:
+027ef640b33b38ca257bb301bb302e9c71d43c27
+
+Tests are excluded from this backport since they would need significant
+rework, the use case will be covered by Beaker.
+
+Fixes: RHEL-63070
+---
+ lib/fsm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/fsm.c b/lib/fsm.c
+index 720d4a2ec..91155c13c 100644
+--- a/lib/fsm.c
++++ b/lib/fsm.c
+@@ -1093,7 +1093,7 @@ setmeta:
+ if (ensureDir(NULL, rpmfiDN(fi), 0, 0, 1, &di.dirfd))
+ continue;
+
+- if (fp->stage > FILE_NONE && !fp->skip) {
++ if (fp->stage > FILE_NONE && !fp->skip && fp->action != FA_TOUCH) {
+ (void) fsmRemove(di.dirfd, fp->fpath, fp->sb.st_mode);
+ }
+ }
+--
+2.47.1
+
diff --git a/gating.yaml b/gating.yaml
index 61de744..864b519 100644
--- a/gating.yaml
+++ b/gating.yaml
@@ -3,4 +3,4 @@ product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1-gating.functional}
+ - !PassingTestCaseRule {test_case_name: osci.brew-build./plans/internal/CI-Tier-1.functional}
diff --git a/python3-rpm.spec b/python3-rpm.spec
index f7d269c..4d771c7 100644
--- a/python3-rpm.spec
+++ b/python3-rpm.spec
@@ -31,14 +31,14 @@
%global rpmver 4.16.1.3
#global snapver rc1
-%global rel 34
+%global rel 37
%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}
@@ -119,6 +119,9 @@ Patch145: 0001-Fix-potential-use-of-uninitialized-pipe-array.patch
Patch146: 0001-Fix-potential-use-of-uninitialized-pgp-struct.patch
Patch147: 0001-Add-SourceLicense-tag-to-spec-syntax.patch
Patch148: 0001-Talk-about-rpmsign-in-the-rpmsign-man-page.patch
+Patch149: 0001-Allow-parametric-macros-to-opt-out-of-option-process.patch
+Patch150: 0001-Report-unsafe-symlinks-during-installation-as-a-spec.patch
+Patch151: 0002-Fix-FA_TOUCH-ed-files-getting-removed-on-failed-upda.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -142,6 +145,12 @@ Patch1001: rpm-4.16.1.3-find_debuginfo_vendor_opts.patch
Patch1002: 0001-Macroize-find-debuginfo-script-location.patch
Patch1003: 0001-Fix-root-relocation-regression.patch
Patch1004: 0001-Skip-to-hashed-subpacket-data-directly.patch
+Patch1005: rpm-4.16.1.3-fix-patch-zero-semantics.patch
+
+# EPEL-only patches
+# Upstream backport for Python 3.13 compatibility
+# From https://github.com/rpm-software-management/rpm/commit/4821d42abb
+Patch3001: 0001-Replace-uses-of-deprecated-PyEval_CallObject-with-Py.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@@ -226,6 +235,8 @@ programs that will manipulate RPM packages and databases.}
%python3x_package
%global python3_pkgversion 3.12
%python3x_package
+%global python3_pkgversion 3.13
+%python3x_package
%prep
%autosetup -n rpm-%{srcver} %{?with_int_bdb:-a 1} -p1
@@ -288,6 +299,8 @@ pushd python
%py3_build
%global python3_pkgversion 3.12
%py3_build
+%global python3_pkgversion 3.13
+%py3_build
popd
%install
@@ -300,6 +313,8 @@ pushd python
%py3_install
%global python3_pkgversion 3.12
%py3_install
+%global python3_pkgversion 3.13
+%py3_install
popd
cat > $RPM_BUILD_ROOT/%{rpmhome}/debugedit << END
@@ -365,6 +380,8 @@ rm -r %{buildroot}%{_sysconfdir}
%py3_check_import rpm rpm.transaction
%global python3_pkgversion 3.12
%py3_check_import rpm rpm.transaction
+%global python3_pkgversion 3.13
+%py3_check_import rpm rpm.transaction
%if %{with check}
make check TESTSUITEFLAGS=-j%{_smp_build_ncpus} || (cat tests/rpmtests.log; exit 1)
# rpm >= 4.16.0 testsuite leaves a read-only tree behind, clean it up
@@ -383,7 +400,28 @@ make clean
%{python3_sitearch}/rpm/
%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
+%global python3_pkgversion 3.13
+%files -n python%{python3_pkgversion}-rpm
+%license COPYING
+%{python3_sitearch}/rpm/
+%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
+
%changelog
+* Thu Jul 03 2025 Miro Hrončok <mhroncok@redhat.com> - 4.16.1.3-37.1
+- Add python3.13-rpm
+
+* Mon Jan 13 2025 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-37
+- Allow parametric macros to opt out of option processing (RHEL-67161)
+- Report unsafe symlinks during installation as a specific case (RHEL-33393)
+- Fix FA_TOUCH'ed files getting removed on failed update (RHEL-63070)
+
+* Wed Nov 06 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-36
+- Improve newly added %%patch warning/error messages (RHEL-6294)
+
+* Wed Oct 16 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-35
+- Fix %%patch N applying Patch0 implicitly (RHEL-6294)
+- Issue deprecation warning for number-less %%patch (RHEL-6294)
+
* Tue Aug 13 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-34
- Fix discarded const qualifier in previous patch (RHEL-22607)
diff --git a/rpm-4.16.1.3-fix-patch-zero-semantics.patch b/rpm-4.16.1.3-fix-patch-zero-semantics.patch
new file mode 100644
index 0000000..63af766
--- /dev/null
+++ b/rpm-4.16.1.3-fix-patch-zero-semantics.patch
@@ -0,0 +1,227 @@
+From 2931047efc31f1288788bcdc8bd1d00b53cb9c76 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Wed, 30 Mar 2022 11:02:23 +0300
+Subject: [PATCH 1/3] Issue warning on implicit "%patch zero" variants,
+ sanitize semantics
+
+Supporting `%patch` with no number specified, in particular combinations
+like `%patch 1` meaning patches 0 and 1 (!), prevents further progress
+in this area. Dropping support for these is a case of sawing off a limb
+to save the patient, but there's enough history to numberless `%patch`
+that we need to take the long route of deprecating it first.
+
+To be exact:
+- we now issue a warning on `%patch` where no patch numbers have been
+ specified, but assume it to mean Patch0 for now
+- `%patch N' applies patch N and nothing else
+
+While at it, avoid an unnecessary strdup() and a dangling buf after
+free.
+
+(cherry picked from commit 02b8d8dccc0f045b0ebf81785cf6ad1056cf550e)
+---
+ build/parsePrep.c | 19 ++++++++-----------
+ 1 file changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/build/parsePrep.c b/build/parsePrep.c
+index d92e5cdf0..533de8a2c 100644
+--- a/build/parsePrep.c
++++ b/build/parsePrep.c
+@@ -380,9 +380,7 @@ exit:
+ * - %patchN is equal to %patch -P\<N\>
+ * - -P\<N\> -P\<N+1\>... can be used to apply several patch on a single line
+ * - Any trailing arguments are treated as patch numbers
+- * - Any combination of the above, except unless at least one -P is specified,
+- * %patch is treated as "numberless patch" so that "%patch 1" actually tries
+- * to pull in numberless "Patch:" and numbered "Patch1:".
++ * - Any combination of the above
+ *
+ * @param spec build info
+ * @param line current line from spec file
+@@ -420,15 +418,8 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
+ /* Convert %patchN to %patch -PN to simplify further processing */
+ if (! strchr(" \t\n", line[6])) {
+ rasprintf(&buf, "%%patch -P %s", line + 6);
+- } else {
+- /* %patch without a number refers to patch 0 */
+- if (strstr(line+6, " -P") == NULL)
+- rasprintf(&buf, "%%patch -P %d %s", 0, line + 6);
+- else
+- buf = xstrdup(line);
+ }
+- poptParseArgvString(buf, &argc, &argv);
+- free(buf);
++ poptParseArgvString(buf ? buf : line, &argc, &argv);
+
+ /*
+ * Grab all -P<N> numbers for later processing. Stored as strings
+@@ -459,6 +450,11 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
+ /* Any trailing arguments are treated as patch numbers */
+ argvAppend(&patchnums, (ARGV_const_t) poptGetArgs(optCon));
+
++ if (argvCount(patchnums) == 0) {
++ rpmlog(RPMLOG_WARNING, _("Patch number not specified: %s\n"), line);
++ argvAdd(&patchnums, "0");
++ }
++
+ /* Convert to number, generate patch command and append to %prep script */
+ for (patch = patchnums; *patch; patch++) {
+ uint32_t pnum;
+@@ -484,6 +480,7 @@ exit:
+ free(opt_d);
+ free(opt_o);
+ free(argv);
++ free(buf);
+ poptFreeContext(optCon);
+ return rc;
+ }
+--
+2.47.0
+
+
+From a8e821ff5c126613e13277bfd8b2050b71d1ea4e Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Fri, 9 Aug 2024 11:57:47 +0200
+Subject: [PATCH 2/3] Safeguard against silent Patch0 omission
+
+Commit 02b8d8dccc0f045b0ebf81785cf6ad1056cf550e fixed %patch so that it
+no longer applies Patch0 implicitly when used without the -P option. A
+side effect of this is that, if a spec happens to rely on this quirky
+behavior, it will now skip Patch0 silently.
+
+To prevent such silent regressions in existing packages, make explicit
+Patch0 application mandatory unless all %patch lines in the spec use the
+non-ambiguous syntax (i.e. %patchN, %patch -PN or %patch 0).
+
+Basically, this reverts the above commit but replaces the original code
+with an error message.
+
+Resolves: RHEL-6294
+---
+ build/parsePrep.c | 16 ++++++++++++++++
+ build/rpmbuild_internal.h | 3 +++
+ build/spec.c | 3 +++
+ 3 files changed, 22 insertions(+)
+
+diff --git a/build/parsePrep.c b/build/parsePrep.c
+index 533de8a2c..9d64c2141 100644
+--- a/build/parsePrep.c
++++ b/build/parsePrep.c
+@@ -418,6 +418,10 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
+ /* Convert %patchN to %patch -PN to simplify further processing */
+ if (! strchr(" \t\n", line[6])) {
+ rasprintf(&buf, "%%patch -P %s", line + 6);
++ } else {
++ /* %patch without a number used to refer to patch 0 */
++ if (strstr(line+6, " -P") == NULL)
++ spec->patch0_implicit = line;
+ }
+ poptParseArgvString(buf ? buf : line, &argc, &argv);
+
+@@ -464,6 +468,8 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
+ *patch, line);
+ goto exit;
+ }
++ if (pnum == 0)
++ spec->patch0_explicit = line;
+ s = doPatch(spec, pnum, opt_p, opt_b, opt_R, opt_E, opt_F, opt_d, opt_o, opt_Z);
+ if (s == NULL) {
+ goto exit;
+@@ -516,8 +522,18 @@ int parsePrep(rpmSpec spec)
+ }
+ }
+
++ if (spec->patch0_implicit && !spec->patch0_explicit &&
++ findSource(spec, 0, RPMBUILD_ISPATCH)) {
++ rpmlog(RPMLOG_ERR, _("Patch0 no longer applied implicitly, pass 0 or -P0: %s\n"),
++ spec->patch0_implicit);
++ res = PART_ERROR;
++ goto exit;
++ }
++
+ exit:
+ argvFree(saveLines);
++ spec->patch0_implicit = NULL;
++ spec->patch0_explicit = NULL;
+
+ return res;
+ }
+diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
+index 797d27744..545cc1f43 100644
+--- a/build/rpmbuild_internal.h
++++ b/build/rpmbuild_internal.h
+@@ -132,6 +132,9 @@ struct rpmSpec_s {
+ int autonum_patch;
+ int autonum_source;
+
++ const char *patch0_implicit;
++ const char *patch0_explicit;
++
+ char * sourceRpmName;
+ unsigned char * sourcePkgId;
+ Package sourcePackage;
+diff --git a/build/spec.c b/build/spec.c
+index 6d402319f..72f0d25bd 100644
+--- a/build/spec.c
++++ b/build/spec.c
+@@ -232,6 +232,9 @@ rpmSpec newSpec(void)
+ spec->autonum_patch = -1;
+ spec->autonum_source = -1;
+
++ spec->patch0_implicit = NULL;
++ spec->patch0_explicit = NULL;
++
+ spec->sourceRpmName = NULL;
+ spec->sourcePkgId = NULL;
+ spec->sourcePackage = NULL;
+--
+2.47.0
+
+
+From 896c7e37d65b1019cc179abcf9524807ba2006d2 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Wed, 6 Nov 2024 16:10:53 +0100
+Subject: [PATCH 3/3] Improve newly added %patch warning/error messages
+
+Make it obvious that the numberless %patch syntax is now *deprecated*
+(and thus no longer works in RHEL-10).
+
+Also suggest an actual fix to the user (in both messages), much like we
+have for the %patchN warning in RPM 4.19 (see commit
+eb5ece1267a22330f6116149997cf5cc1c22b21f).
+
+Kudos to Eva Mrakova for noticing & suggesting this.
+
+Related: RHEL-6294
+---
+ build/parsePrep.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/build/parsePrep.c b/build/parsePrep.c
+index 9d64c2141..63014ea89 100644
+--- a/build/parsePrep.c
++++ b/build/parsePrep.c
+@@ -455,7 +455,8 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
+ argvAppend(&patchnums, (ARGV_const_t) poptGetArgs(optCon));
+
+ if (argvCount(patchnums) == 0) {
+- rpmlog(RPMLOG_WARNING, _("Patch number not specified: %s\n"), line);
++ rpmlog(RPMLOG_WARNING, _("%%patch (without a number) is deprecated, "
++ "add 0 (or -P 0): %s\n"), line);
+ argvAdd(&patchnums, "0");
+ }
+
+@@ -524,8 +525,8 @@ int parsePrep(rpmSpec spec)
+
+ if (spec->patch0_implicit && !spec->patch0_explicit &&
+ findSource(spec, 0, RPMBUILD_ISPATCH)) {
+- rpmlog(RPMLOG_ERR, _("Patch0 no longer applied implicitly, pass 0 or -P0: %s\n"),
+- spec->patch0_implicit);
++ rpmlog(RPMLOG_ERR, _("%%patch N no longer applies Patch0 implicitly, "
++ "add 0 (or -P 0): %s\n"), spec->patch0_implicit);
+ res = PART_ERROR;
+ goto exit;
+ }
+--
+2.47.0
+
^ permalink raw reply related [flat|nested] 6+ messages in thread* [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
@ 2026-11-13 19:46
0 siblings, 0 replies; 6+ messages in thread
From: @ 2026-11-13 19:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9-next
Commit : 4f71c1a9d56cf1505fc9efc70ce06f4f05a77023
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2024-11-26T16:40:11+01:00
Stats : +469/-1 in 9 file(s)
URL : https://src.fedoraproject.org/rpms/python3-rpm/c/4f71c1a9d56cf1505fc9efc70ce06f4f05a77023?branch=epel9-next
Log:
Merge epel9-next into epel9
---
diff --git a/0001-Add-SourceLicense-tag-to-spec-syntax.patch b/0001-Add-SourceLicense-tag-to-spec-syntax.patch
new file mode 100644
index 0000000..0f48138
--- /dev/null
+++ b/0001-Add-SourceLicense-tag-to-spec-syntax.patch
@@ -0,0 +1,124 @@
+From 1dc9372821487ccace23ff1ae9cba6b30f02c91c Mon Sep 17 00:00:00 2001
+From: Florian Festi <ffesti@redhat.com>
+Date: Tue, 5 Jul 2022 16:34:08 +0200
+Subject: [PATCH] Add SourceLicense tag to spec syntax
+
+to set a separate license to the source RPM. This can be useful if the
+sources have code under additional licenses that do not end up in the
+binary packeges.
+
+Resolves: #2079
+
+Note on the backport: The spec document on this branch is ancient and
+doesn't even contain the License tag's description so this backport
+leaves the documentation part out.
+
+(backported from commit 9ed9d3fce34bc3c8121989e0cf263528e7e68756)
+---
+ build/parsePreamble.c | 6 ++++++
+ lib/rpmtag.h | 3 +++
+ tests/data/SPECS/foo.spec | 1 +
+ tests/data/SPECS/hello.spec | 1 +
+ tests/rpmbuild.at | 11 +++++++++++
+ tests/rpmspec.at | 1 +
+ 6 files changed, 23 insertions(+)
+
+diff --git a/build/parsePreamble.c b/build/parsePreamble.c
+index e7d6d8752..bd07ecdf0 100644
+--- a/build/parsePreamble.c
++++ b/build/parsePreamble.c
+@@ -831,6 +831,11 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
+ if (addLangTag(spec, pkg->header, tag, field, lang))
+ goto exit;
+ break;
++ case RPMTAG_SOURCELICENSE:
++ if (addLangTag(spec, spec->sourcePackage->header,
++ RPMTAG_LICENSE, field, lang))
++ goto exit;
++ break;
+ case RPMTAG_BUILDROOT:
+ /* just silently ignore BuildRoot */
+ break;
+@@ -1012,6 +1017,7 @@ static struct PreambleRec_s const preambleList[] = {
+ {RPMTAG_EPOCH, 0, 0, 1, LEN_AND_STR("epoch")},
+ {RPMTAG_SUMMARY, 1, 0, 1, LEN_AND_STR("summary")},
+ {RPMTAG_LICENSE, 0, 0, 1, LEN_AND_STR("license")},
++ {RPMTAG_SOURCELICENSE, 0, 0, 1, LEN_AND_STR("sourcelicense")},
+ {RPMTAG_DISTRIBUTION, 0, 0, 1, LEN_AND_STR("distribution")},
+ {RPMTAG_DISTURL, 0, 0, 1, LEN_AND_STR("disturl")},
+ {RPMTAG_VENDOR, 0, 0, 1, LEN_AND_STR("vendor")},
+diff --git a/lib/rpmtag.h b/lib/rpmtag.h
+index 7d1943835..1fd829118 100644
+--- a/lib/rpmtag.h
++++ b/lib/rpmtag.h
+@@ -375,6 +375,9 @@ typedef enum rpmTag_e {
+ RPMTAG_MODULARITYLABEL = 5096, /* s */
+ RPMTAG_PAYLOADDIGESTALT = 5097, /* s[] */
+
++ /* Backports */
++ RPMTAG_SOURCELICENSE = 5102, /* internal */
++
+ RPMTAG_FIRSTFREE_TAG /*!< internal */
+ } rpmTag;
+
+diff --git a/tests/data/SPECS/foo.spec b/tests/data/SPECS/foo.spec
+index 859e98142..9b1087094 100644
+--- a/tests/data/SPECS/foo.spec
++++ b/tests/data/SPECS/foo.spec
+@@ -8,6 +8,7 @@ Source: hello-2.0.tar.gz
+ Patch1: hello-1.0-modernize.patch
+ Group: Testing
+ License: GPLv2+
++SourceLicense: GPL, ASL 1.0
+ BuildArch: noarch
+
+ %description
+diff --git a/tests/data/SPECS/hello.spec b/tests/data/SPECS/hello.spec
+index 5bc9cfaf7..4b9053aca 100644
+--- a/tests/data/SPECS/hello.spec
++++ b/tests/data/SPECS/hello.spec
+@@ -4,6 +4,7 @@ Version: 1.0
+ Release: 1
+ Group: Utilities
+ License: GPL
++SourceLicense: GPL, ASL 1.0
+ Distribution: RPM test suite.
+ Vendor: Red Hat Software
+ Packager: Red Hat Software <bugs@redhat.com>
+diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
+index bff65303b..7680f1502 100644
+--- a/tests/rpmbuild.at
++++ b/tests/rpmbuild.at
+@@ -31,6 +31,17 @@ run rpmbuild \
+ [0],
+ [ignore],
+ [ignore])
++
++AT_CHECK([
++
++runroot rpm -qp --qf "%{license}\n" /build/SRPMS/hello-1.0-1.src.rpm
++runroot rpm -qp --qf "%{license}\n" /build/RPMS/*/hello-1.0-1.*.rpm
++],
++[0],
++[GPL, ASL 1.0
++GPL
++],
++[])
+ AT_CLEANUP
+
+ AT_SETUP([rpmbuild -ba autosetup])
+diff --git a/tests/rpmspec.at b/tests/rpmspec.at
+index 2b11201db..c898ee654 100644
+--- a/tests/rpmspec.at
++++ b/tests/rpmspec.at
+@@ -243,6 +243,7 @@ Source: hello-2.0.tar.gz
+ Patch1: hello-1.0-modernize.patch
+ Group: Testing
+ License: GPLv2+
++SourceLicense: GPL, ASL 1.0
+ BuildArch: noarch
+
+ %description
+--
+2.45.2
+
diff --git a/0001-Don-t-segfault-on-missing-priority-tag.patch b/0001-Don-t-segfault-on-missing-priority-tag.patch
new file mode 100644
index 0000000..32a72dc
--- /dev/null
+++ b/0001-Don-t-segfault-on-missing-priority-tag.patch
@@ -0,0 +1,39 @@
+From fd57fc716231c8296d340fdb4c0f6eac176f7f7c Mon Sep 17 00:00:00 2001
+From: Florian Festi <ffesti@redhat.com>
+Date: Fri, 20 Aug 2021 15:14:16 +0200
+Subject: [PATCH] Don't segfault on missing priority tag
+
+Resolves: #1636
+Related: #1638
+---
+ lib/rpmtriggers.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/lib/rpmtriggers.c b/lib/rpmtriggers.c
+index fc809a65e..d541974e8 100644
+--- a/lib/rpmtriggers.c
++++ b/lib/rpmtriggers.c
+@@ -517,7 +517,8 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
+ if (matchFunc(ts, te, pfx, sense)) {
+ for (i = 0; i < rpmdbIndexIteratorNumPkgs(ii); i++) {
+ struct rpmtd_s priorities;
+- unsigned int priority;
++ unsigned int priority = 0;
++ unsigned int *priority_ptr;
+ unsigned int offset = rpmdbIndexIteratorPkgOffset(ii, i);
+ unsigned int tix = rpmdbIndexIteratorTagNum(ii, i);
+
+@@ -535,7 +536,9 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
+ trigH = rpmdbGetHeaderAt(rpmtsGetRdb(ts), offset);
+ headerGet(trigH, priorityTag, &priorities, HEADERGET_MINMEM);
+ rpmtdSetIndex(&priorities, tix);
+- priority = *rpmtdGetUint32(&priorities);
++ priority_ptr = rpmtdGetUint32(&priorities);
++ if (priority_ptr)
++ priority = *priority_ptr;
+ headerFree(trigH);
+
+ /* Store file trigger in array */
+--
+2.45.1
+
diff --git a/0001-Fix-potential-use-of-uninitialized-pgp-struct.patch b/0001-Fix-potential-use-of-uninitialized-pgp-struct.patch
new file mode 100644
index 0000000..3d4557c
--- /dev/null
+++ b/0001-Fix-potential-use-of-uninitialized-pgp-struct.patch
@@ -0,0 +1,12 @@
+diff -up rpm-4.16.1.3/lib/rpmts.c.orig rpm-4.16.1.3/lib/rpmts.c
+--- rpm-4.16.1.3/lib/rpmts.c.orig 2024-07-11 13:55:35.430198126 +0200
++++ rpm-4.16.1.3/lib/rpmts.c 2024-07-11 13:55:59.243061182 +0200
+@@ -482,6 +482,8 @@ static int makePubkeyHeader(rpmts ts, rp
+ int rc = -1;
+ int i;
+
++ memset(&kd, 0, sizeof(kd));
++
+ if ((enc = rpmPubkeyBase64(key)) == NULL)
+ goto exit;
+ if ((dig = rpmPubkeyDig(key)) == NULL)
diff --git a/0001-Fix-potential-use-of-uninitialized-pipe-array.patch b/0001-Fix-potential-use-of-uninitialized-pipe-array.patch
new file mode 100644
index 0000000..dcabc59
--- /dev/null
+++ b/0001-Fix-potential-use-of-uninitialized-pipe-array.patch
@@ -0,0 +1,32 @@
+From bff65aad8af719542c7b0c6429e09223c014a909 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Thu, 6 Jun 2024 09:15:02 +0200
+Subject: [PATCH] Fix potential use of uninitialized pipe array
+
+We only call pipe(2) after the script is written to disk so if the
+latter fails, the array will be left uninitialized and subsequently read
+after skipping to the exit label. Fix by initializing it.
+
+Found by Coverity.
+
+Fixes: RHEL-22604
+---
+ lib/rpmscript.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/rpmscript.c b/lib/rpmscript.c
+index 281c55c53..1de4acf8e 100644
+--- a/lib/rpmscript.c
++++ b/lib/rpmscript.c
+@@ -316,7 +316,7 @@ static rpmRC runExtScript(rpmPlugins plugins, ARGV_const_t prefixes,
+ char * fn = NULL;
+ pid_t pid, reaped;
+ int status;
+- int inpipe[2];
++ int inpipe[2] = { -1, -1 };
+ FILE *in = NULL;
+ const char *line;
+ char *mline = NULL;
+--
+2.45.2
+
diff --git a/0001-Fix-root-relocation-regression.patch b/0001-Fix-root-relocation-regression.patch
new file mode 100644
index 0000000..e4ce8b6
--- /dev/null
+++ b/0001-Fix-root-relocation-regression.patch
@@ -0,0 +1,91 @@
+From bce17e42f2301a88574d757740627480a38d86aa Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Fri, 26 Jul 2024 10:44:04 +0200
+Subject: [PATCH] Fix root relocation regression
+
+When relocating the root directory, make sure we insert the new path's
+dirname to dirNames[] even if the root itself is owned by the package.
+
+This appears to have been the intention from the first version (largely
+untouched since) of this code as we allow the root to pass through the
+first checks (by setting len to 0 in that case) as well as the second
+for loop where we do the relocations.
+
+This allows fsm to properly create and remove the relocated directory
+since we're now using fd-based calls (#1919) and the parent directory
+needs to be opened first.
+
+No need to do string comparison here, the empty basename signals that
+we're processing the root directory, so just use that.
+
+Building a relocatable package that owns the root directory seems to be
+a handy way to create user-installable packages (see RHEL-28967) and it
+happened to work before with the path-based calls so this technically
+was a regression. Add a test that emulates this use case.
+
+Backported from commits:
+31c14ba6610568c2d634647fed1fb57221178da9
+308ac60677732e9979b9ce11e5a3085906da1901
+
+Fixes: RHEL-28967
+---
+ lib/relocation.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/lib/relocation.c b/lib/relocation.c
+index 3ba4cfeab..8c35bc1a7 100644
+--- a/lib/relocation.c
++++ b/lib/relocation.c
+@@ -123,7 +123,7 @@ void rpmRelocateFileList(rpmRelocation *relocations, int numRelocations,
+ char ** baseNames;
+ char ** dirNames;
+ uint32_t * dirIndexes;
+- rpm_count_t fileCount, dirCount;
++ rpm_count_t fileCount, dirCount, dirCountOrig;
+ int nrelocated = 0;
+ int fileAlloced = 0;
+ char * fn = NULL;
+@@ -162,7 +162,7 @@ void rpmRelocateFileList(rpmRelocation *relocations, int numRelocations,
+ baseNames = bnames.data;
+ dirIndexes = dindexes.data;
+ fileCount = rpmtdCount(&bnames);
+- dirCount = rpmtdCount(&dnames);
++ dirCount = dirCountOrig = rpmtdCount(&dnames);
+ /* XXX TODO: use rpmtdDup() instead */
+ dirNames = dnames.data = duparray(dnames.data, dirCount);
+ dnames.flags |= RPMTD_PTR_ALLOCED;
+@@ -179,8 +179,9 @@ void rpmRelocateFileList(rpmRelocation *relocations, int numRelocations,
+ rpmFileTypes ft;
+ int fnlen;
+
++ size_t baselen = strlen(baseNames[i]);
+ size_t len = maxlen +
+- strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1;
++ strlen(dirNames[dirIndexes[i]]) + baselen + 1;
+ if (len >= fileAlloced) {
+ fileAlloced = len * 2;
+ fn = xrealloc(fn, fileAlloced);
+@@ -242,8 +243,9 @@ assert(fn != NULL); /* XXX can't happen */
+ continue;
+ }
+
+- /* Relocation on full paths only, please. */
+- if (fnlen != len) continue;
++ /* Relocation on '/' and full paths only, please. */
++ if (baselen && fnlen != len)
++ continue;
+
+ rpmlog(RPMLOG_DEBUG, "relocating %s to %s\n",
+ fn, relocations[j].newPath);
+@@ -294,7 +296,7 @@ assert(fn != NULL); /* XXX can't happen */
+ }
+
+ /* Finish off by relocating directories. */
+- for (i = dirCount - 1; i >= 0; i--) {
++ for (i = dirCountOrig - 1; i >= 0; i--) {
+ for (j = numRelocations - 1; j >= 0; j--) {
+
+ if (relocations[j].oldPath == NULL) /* XXX can't happen */
+--
+2.45.2
+
diff --git a/0001-Skip-to-hashed-subpacket-data-directly.patch b/0001-Skip-to-hashed-subpacket-data-directly.patch
new file mode 100644
index 0000000..ada500e
--- /dev/null
+++ b/0001-Skip-to-hashed-subpacket-data-directly.patch
@@ -0,0 +1,51 @@
+From f6ffaacbbf7f5aca45139a612c5dd8db3f2094dc Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Mon, 5 Aug 2024 14:40:57 +0200
+Subject: [PATCH] Skip to hashed subpacket data directly
+
+Let OpenScanHub grok the bigger picture instead of producing a spurious
+overrun warning for v->hashlen when we're dereferencing p later.
+
+Casting the v pointer back to uint8_t is unnecessary when we could just
+use h directly but it's done this way in the if branch for pgp version 3
+in this function as well as in pgpPrtKey() so copy that, just for the
+sake of consistency.
+
+Along the same lines (consistency), change the p pointer to a const
+pointer.
+
+No functional change.
+
+Resolves: RHEL-22607
+---
+ rpmio/rpmpgp.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
+index d0688ebe9..6f044eb1b 100644
+--- a/rpmio/rpmpgp.c
++++ b/rpmio/rpmpgp.c
+@@ -565,7 +565,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
+ pgpDigParams _digp)
+ {
+ uint8_t version = 0;
+- uint8_t * p;
++ const uint8_t * p;
+ unsigned int plen;
+ int rc = 1;
+
+@@ -618,10 +618,9 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
+ pgpPrtVal(" ", pgpSigTypeTbl, v->sigtype);
+ pgpPrtNL();
+
+- p = &v->hashlen[0];
+ if (pgpGet(v->hashlen, sizeof(v->hashlen), h + hlen, &plen))
+ return 1;
+- p += sizeof(v->hashlen);
++ p = ((uint8_t *)v) + sizeof(*v);
+
+ if ((p + plen) > (h + hlen))
+ return 1;
+--
+2.46.0
+
diff --git a/0001-Talk-about-rpmsign-in-the-rpmsign-man-page.patch b/0001-Talk-about-rpmsign-in-the-rpmsign-man-page.patch
new file mode 100644
index 0000000..e198993
--- /dev/null
+++ b/0001-Talk-about-rpmsign-in-the-rpmsign-man-page.patch
@@ -0,0 +1,57 @@
+From d29651be364ef72c7c0f468157602e4ed5cab4ff Mon Sep 17 00:00:00 2001
+From: Florian Festi <ffesti@redhat.com>
+Date: Wed, 12 Jun 2024 15:46:12 +0200
+Subject: [PATCH] Talk about rpmsign in the rpmsign man page
+
+In the past handling signatures was done by the rpm / rpmbuild binaries
+directly. When this functionality was split into rpmsign the man page
+was not adjusted accoringly. This is the long overdue update.
+
+Resolves: # 3125
+
+(backported from commit 8e1f55c7004e8c1a7d9140ab2dd9456a7ace3e77)
+---
+ doc/rpmsign.8 | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/doc/rpmsign.8 b/doc/rpmsign.8
+index f7ceae89b..6c5bcc8ef 100644
+--- a/doc/rpmsign.8
++++ b/doc/rpmsign.8
+@@ -5,9 +5,9 @@ rpmsign \- RPM Package Signing
+ .SS "SIGNING PACKAGES:"
+ .PP
+
+-\fBrpm\fR \fB--addsign|--resign\fR [\fBrpmsign-options\fR] \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
++\fBrpmsign\fR \fB--addsign|--resign\fR [\fBrpmsign-options\fR] \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
+
+-\fBrpm\fR \fB--delsign\fR \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
++\fBrpmsign\fR \fB--delsign\fR \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
+
+ .SS "rpmsign-options"
+ .PP
+@@ -22,10 +22,10 @@ options generate and insert new signatures for each package
+ existing signatures. There are two options for historical reasons,
+ there is no difference in behavior currently.
+
+-To create a signature rpm needs to verify the package's checksum. As a result
++To create a signature rpmsign needs to verify the package's checksum. As a result
+ packages with a MD5/SHA1 checksums cannot be signed in FIPS mode.
+
+-\fBrpm\fR \fB--delsign\fR \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
++\fBrpmsign\fR \fB--delsign\fR \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
+
+ .PP
+ Delete all signatures from each package \fIPACKAGE_FILE\fR given.
+@@ -36,7 +36,7 @@ Delete all signatures from each package \fIPACKAGE_FILE\fR given.
+ \fB--rpmv3\fR
+ Force RPM V3 header+payload signature addition.
+ These are expensive and redundant baggage on packages where a separate
+-payload digest exists (packages built with rpm >= 4.14). Rpm will
++payload digest exists (packages built with rpm >= 4.14). Rpmsign will
+ automatically detect the need for V3 signatures, but this option can be
+ used to force their creation if the packages must be fully
+ signature verifiable with rpm < 4.14 or other interoperability reasons.
+--
+2.45.2
+
diff --git a/0001-Use-unsigned-integers-for-buildtime-too-for-Y2K38-sa.patch b/0001-Use-unsigned-integers-for-buildtime-too-for-Y2K38-sa.patch
new file mode 100644
index 0000000..f66545b
--- /dev/null
+++ b/0001-Use-unsigned-integers-for-buildtime-too-for-Y2K38-sa.patch
@@ -0,0 +1,32 @@
+From 97aa64d8281974fb369c66d5aef8650515b89c52 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Wed, 24 Jan 2024 12:03:39 +0200
+Subject: [PATCH] Use unsigned integers for buildtime too for Y2K38 safety
+
+This little patch buys us 68 extra years to move to 64bit time tags
+in rpm. That seems achievable.
+
+Fixes: #1228
+---
+ build/build.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build/build.c b/build/build.c
+index e4081c673..0ac8bf6c9 100644
+--- a/build/build.c
++++ b/build/build.c
+@@ -36,9 +36,9 @@ static rpm_time_t getBuildTime(void)
+ if (srcdate == endptr || *endptr || errno != 0)
+ rpmlog(RPMLOG_ERR, _("unable to parse SOURCE_DATE_EPOCH\n"));
+ else
+- buildTime = (int32_t) epoch;
++ buildTime = (uint32_t) epoch;
+ } else
+- buildTime = (int32_t) time(NULL);
++ buildTime = (uint32_t) time(NULL);
+
+ return buildTime;
+ }
+--
+2.45.1
+
diff --git a/python3-rpm.spec b/python3-rpm.spec
index 3346a38..f7d269c 100644
--- a/python3-rpm.spec
+++ b/python3-rpm.spec
@@ -31,7 +31,7 @@
%global rpmver 4.16.1.3
#global snapver rc1
-%global rel 29
+%global rel 34
%global sover 9
%global rhelrel %{?snapver:0.%{snapver}.}%{rel}
%global rel_next %{lua:print(tonumber(rpm.expand("%rel")) + 1)}
@@ -113,6 +113,12 @@ Patch134: 0001-Don-t-warn-about-missing-user-group-on-skipped-files.patch
Patch140: 0001-Fix-short-circuiting-of-version-strings-in-expressio.patch
Patch141: 0001-Fix-a-copy-paste-help-description-of-whatconflicts-R.patch
Patch142: 0001-Expose-and-document-rpmdb-verifydb-operation.patch
+Patch143: 0001-Don-t-segfault-on-missing-priority-tag.patch
+Patch144: 0001-Use-unsigned-integers-for-buildtime-too-for-Y2K38-sa.patch
+Patch145: 0001-Fix-potential-use-of-uninitialized-pipe-array.patch
+Patch146: 0001-Fix-potential-use-of-uninitialized-pgp-struct.patch
+Patch147: 0001-Add-SourceLicense-tag-to-spec-syntax.patch
+Patch148: 0001-Talk-about-rpmsign-in-the-rpmsign-man-page.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -134,6 +140,8 @@ Patch916: 0006-debugedit-Handle-DWARF-5-debug_line-and-debug_line_s.patch
Patch1000: rpm-4.16.1.3-hashtab-use-after-free-fix.patch
Patch1001: rpm-4.16.1.3-find_debuginfo_vendor_opts.patch
Patch1002: 0001-Macroize-find-debuginfo-script-location.patch
+Patch1003: 0001-Fix-root-relocation-regression.patch
+Patch1004: 0001-Skip-to-hashed-subpacket-data-directly.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@@ -376,6 +384,28 @@ make clean
%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
%changelog
+* Tue Aug 13 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-34
+- Fix discarded const qualifier in previous patch (RHEL-22607)
+
+* Mon Aug 05 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-33
+- Fix root relocation regression (RHEL-28967)
+- Don't confuse OpenScanHub with false array overrun (RHEL-22607)
+
+* Fri Jul 12 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-32
+- Revert incorrect fix for false array overrun (RHEL-22607)
+
+* Fri Jul 12 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-31
+- Fix potential use of uninitialized pipe array (RHEL-22604)
+- Fix potential use of uninitialized pgp struct (RHEL-22605)
+- Don't confuse OpenScanHub with false array overrun (RHEL-22607)
+- Add SourceLicense tag to spec syntax (RHEL-28798)
+- Talk about rpmsign in the rpmsign(8) man page (RHEL-40895)
+
+* Mon Jun 03 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-30
+- Don't segfault on missing priority tag (RHEL-35249)
+- Use unsigned integers for buildtime too for Y2K38 safety (RHEL-22602)
+- Rebuild against libimaevm.so.4 (RHEL-32505)
+
* Mon Jan 29 2024 Miro Hrončok <mhroncok@redhat.com> - 4.16.1.3-29.2
- Add python3.12-rpm
^ permalink raw reply related [flat|nested] 6+ messages in thread* [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
@ 2026-11-13 19:46
0 siblings, 0 replies; 6+ messages in thread
From: @ 2026-11-13 19:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9-next
Commit : fe7da011ec5a9bd289d5495d11c65512ba823ec4
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2025-12-10T12:19:38+01:00
Stats : +903/-1 in 5 file(s)
URL : https://src.fedoraproject.org/rpms/python3-rpm/c/fe7da011ec5a9bd289d5495d11c65512ba823ec4?branch=epel9-next
Log:
Merge epel9-next into epel9
---
diff --git a/0001-Allow-an-optional-override-clock-for-deterministic-t.patch b/0001-Allow-an-optional-override-clock-for-deterministic-t.patch
new file mode 100644
index 0000000..45672e5
--- /dev/null
+++ b/0001-Allow-an-optional-override-clock-for-deterministic-t.patch
@@ -0,0 +1,202 @@
+From 1faf306bf4f2df3e9a5d089c5cae52e6071c564a Mon Sep 17 00:00:00 2001
+From: Benno Rice <benno.rice@oracle.com>
+Date: Thu, 21 Oct 2021 22:16:55 +1100
+Subject: [PATCH] Allow an optional "override clock" for deterministic
+ timestamps
+
+When trying to achieve a fully reproducible build process for an
+OS image timestamps are a major source of variance. The RPM
+database contains two fields in package header records that
+are relevant here:
+
+- RPMTAG_INSTALLTIME which is an explicit timestamp indicating
+ when the package was installed.
+- RPMTAG_INSTALLTID which is an opaque value represending the
+ transaction ID under which a package was installed but in terms
+ of internal implementation is also a timestamp.
+
+This change allows the presence of the SOURCE_DATE_EPOCH
+environment variable, commonly used to override timestamps in
+build systems, to institute an "override time" mode in which
+values for RPMTAG_INSTALLTID and RPMTAG_INSTALLTIME become
+predicatble.
+
+(backported from commit 71456f2fc09900a027a33dc3d6d75c69a9b39488)
+---
+ lib/psm.c | 2 +-
+ lib/rpmts.c | 24 ++++++++++++++++++-
+ lib/rpmts_internal.h | 5 ++++
+ lib/transaction.c | 2 +-
+ tests/rpmi.at | 57 ++++++++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 87 insertions(+), 3 deletions(-)
+
+diff --git a/lib/psm.c b/lib/psm.c
+index b37e077a9..08de76764 100644
+--- a/lib/psm.c
++++ b/lib/psm.c
+@@ -553,7 +553,7 @@ static rpmRC dbAdd(rpmts ts, rpmte te)
+ {
+ Header h = rpmteHeader(te);
+ Header auxh = rpmteHeaderAux(te, 0);
+- rpm_time_t installTime = (rpm_time_t) time(NULL);
++ rpm_time_t installTime = rpmtsGetTime(ts, 1);
+ rpmfs fs = rpmteGetFileStates(te);
+ rpm_count_t fc = rpmfsFC(fs);
+ rpm_fstate_t * fileStates = rpmfsGetStates(fs);
+diff --git a/lib/rpmts.c b/lib/rpmts.c
+index c3a0768a4..69888acfc 100644
+--- a/lib/rpmts.c
++++ b/lib/rpmts.c
+@@ -1086,6 +1086,7 @@ rpmts rpmtsCreate(void)
+ {
+ rpmts ts;
+ tsMembers tsmem;
++ char *source_date_epoch = NULL;
+
+ ts = xcalloc(1, sizeof(*ts));
+ memset(&ts->ops, 0, sizeof(ts->ops));
+@@ -1098,8 +1099,15 @@ rpmts rpmtsCreate(void)
+ ts->rdb = NULL;
+ ts->dbmode = O_RDONLY;
+
++ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
++ if (source_date_epoch != NULL) {
++ ts->overrideTime = (time_t)strtol(source_date_epoch, NULL, 10);
++ } else {
++ ts->overrideTime = (time_t)-1;
++ }
++
+ ts->scriptFd = NULL;
+- ts->tid = (rpm_tid_t) time(NULL);
++ ts->tid = (rpm_tid_t) rpmtsGetTime(ts, 0);
+
+ ts->color = rpmExpandNumeric("%{?_transaction_color}");
+ ts->prefcolor = rpmExpandNumeric("%{?_prefer_color}")?:2;
+@@ -1155,6 +1163,20 @@ rpmts rpmtsCreate(void)
+ return rpmtsLink(ts);
+ }
+
++rpm_time_t rpmtsGetTime(rpmts ts, time_t step)
++{
++ time_t tstime;
++
++ if (ts->overrideTime == (time_t)-1) {
++ tstime = time(NULL);
++ } else {
++ tstime = ts->overrideTime;
++ ts->overrideTime += step;
++ }
++
++ return (rpm_time_t)tstime;
++}
++
+ rpmtsi rpmtsiFree(rpmtsi tsi)
+ {
+ /* XXX watchout: a funky recursion segfaults here iff nrefs is wrong. */
+diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h
+index 8105b19a6..e479f86d3 100644
+--- a/lib/rpmts_internal.h
++++ b/lib/rpmts_internal.h
+@@ -87,6 +87,8 @@ struct rpmts_s {
+ rpmtriggers trigs2run; /*!< Transaction file triggers */
+
+ int min_writes; /*!< macro minimize_writes used */
++
++ time_t overrideTime; /*!< Time value used when overriding system clock. */
+ };
+
+ #ifdef __cplusplus
+@@ -123,6 +125,9 @@ RPM_GNUC_INTERNAL
+ rpmRC runScript(rpmts ts, rpmte te, Header h, ARGV_const_t prefixes,
+ rpmScript script, int arg1, int arg2);
+
++RPM_GNUC_INTERNAL
++rpm_time_t rpmtsGetTime(rpmts ts, time_t step);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff --git a/lib/transaction.c b/lib/transaction.c
+index d547b32b6..ae1ce99f0 100644
+--- a/lib/transaction.c
++++ b/lib/transaction.c
+@@ -1491,7 +1491,7 @@ static int runTransScripts(rpmts ts, pkgGoal goal)
+
+ static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet)
+ {
+- rpm_tid_t tid = (rpm_tid_t) time(NULL);
++ rpm_tid_t tid = (rpm_tid_t) rpmtsGetTime(ts, 0);
+ int dbmode = (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) ? O_RDONLY : (O_RDWR|O_CREAT);
+
+ if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
+diff --git a/tests/rpmi.at b/tests/rpmi.at
+index 42dc52ba3..f09bb4c11 100644
+--- a/tests/rpmi.at
++++ b/tests/rpmi.at
+@@ -352,6 +352,63 @@ error: hello-2.0-1.x86_64: install failed
+ [])
+ AT_CLEANUP
+
++# ------------------------------
++# Test tid/time overrides using SOURCE_DATE_EPOCH
++AT_SETUP([rpm -i <overridden time>])
++AT_KEYWORDS([install])
++AT_CHECK([
++RPMDB_INIT
++
++pkg="hello-2.0-1.x86_64"
++timestamp=97445
++
++runroot rpm -i --ignorearch --ignoreos --nodeps \
++ /data/RPMS/foo-1.0-1.noarch.rpm
++export SOURCE_DATE_EPOCH=$timestamp
++runroot rpm -i --ignorearch --ignoreos --nodeps \
++ /data/RPMS/hello-2.0-1.x86_64.rpm
++unset SOURCE_DATE_EPOCH
++runroot rpm -q --tid $timestamp
++runroot rpm -qi $pkg | grep "Install Date"
++runroot rpm -qa
++
++],
++[0],
++[hello-2.0-1.x86_64
++Install Date: Fri Jan 2 03:04:05 1970
++foo-1.0-1.noarch
++hello-2.0-1.x86_64
++],
++[])
++AT_CLEANUP
++
++# ------------------------------
++# Test multiple installs using SOURCE_DATE_EPOCH
++AT_SETUP([rpm -i <overridden time keeps ticking>])
++AT_KEYWORDS([install])
++AT_CHECK([
++RPMDB_INIT
++
++timestamp=1445412535
++
++export SOURCE_DATE_EPOCH=$timestamp
++runroot rpm -i --ignorearch --ignoreos --nodeps \
++ /data/RPMS/foo-1.0-1.noarch.rpm /data/RPMS/hello-2.0-1.x86_64.rpm
++unset SOURCE_DATE_EPOCH
++runroot rpm -q --tid $timestamp
++for pkg in `runroot rpm -q --tid $timestamp`; do
++ runroot rpm -qi $pkg | grep "Install Date"
++done
++],
++[0],
++[hello-2.0-1.x86_64
++foo-1.0-1.noarch
++Install Date: Wed Oct 21 07:28:55 2015
++Install Date: Wed Oct 21 07:28:56 2015
++],
++[])
++AT_CLEANUP
++
+ # ------------------------------
+ # Check if rpm -U *.src.rpm works
+ AT_SETUP([rpm -U *.src.rpm])
+--
+2.50.1
+
diff --git a/0001-Fix-a-race-condition-in-brp-strip.patch b/0001-Fix-a-race-condition-in-brp-strip.patch
new file mode 100644
index 0000000..4928b54
--- /dev/null
+++ b/0001-Fix-a-race-condition-in-brp-strip.patch
@@ -0,0 +1,98 @@
+From c91c9b4e55917bfb4bd4ae55dc707b3910cf009a Mon Sep 17 00:00:00 2001
+From: Shreenidhi Shedi <sshedi@vmware.com>
+Date: Mon, 8 Aug 2022 01:39:02 +0530
+Subject: [PATCH 1/3] Fix a race condition in brp-strip
+
+brp-strip script runs strip command on deliverables paralley and if
+deliverables are hard linked inside buildroot, it will create
+contention.
+
+One good example for such package is git.
+https://github.com/vmware/photon/blob/master/SPECS/git/git.spec
+
+```
+Sample output:
+$ rpm -ql git | grep libexec | xargs ls -li
+668153 -rwxr-xr-x 137 root root 3401056 Aug 2 08:30 /usr/libexec/git-core/git
+668153 -rwxr-xr-x 137 root root 3401056 Aug 2 08:30 /usr/libexec/git-core/git-add
+787238 -rwxr-xr-x 1 root root 47770 Aug 2 08:30 /usr/libexec/git-core/git-add--interactive
+668153 -rwxr-xr-x 137 root root 3401056 Aug 2 08:30 /usr/libexec/git-core/git-am
+```
+
+To overcome this, we run strip twice once for all files with no
+hardlinks, this is a parallel job, meaning multiple binaries will be
+stripped in parallel.
+
+And once for files with hardlinks, in this case we disable parallel
+processing and strip binaries in sequential order.
+
+RH bug link:
+https://bugzilla.redhat.com/show_bug.cgi?id=1959049
+
+Co-authored-by: Dweep Advani <dadvani@vmware.com>
+Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
+
+Backported from commits:
+ae2e75a129150b808ff1edf80dc8851e4a63a226
+
+Fixes: RHEL-74011
+---
+ scripts/brp-strip | 35 ++++++++++++++++++++++++++++++++---
+ 1 file changed, 32 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/brp-strip b/scripts/brp-strip
+index 35fbb593a..3283d7c84 100755
+--- a/scripts/brp-strip
++++ b/scripts/brp-strip
+@@ -1,4 +1,5 @@
+ #!/bin/sh
++
+ # If using normal root, avoid changing anything.
+ if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+@@ -7,11 +8,39 @@ fi
+ STRIP=${1:-strip}
+ NCPUS=${RPM_BUILD_NCPUS:-1}
+
++# 32 was chosen as a compromise between reducing the overhead of starting new
++# processes and distributing the work load evenly over as much processors as
++# possible
++MAX_ARGS=32
++
+ case `uname -a` in
+ Darwin*) exit 0 ;;
+ *) ;;
+ esac
+
+-# Strip ELF binaries
+-find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \
+- xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0
++# Below is the explanation of commands in the order of their appearance
++# Ignore /usr/lib/debug entries
++# Ignore all go(guile objects & golang) files
++# Consider files with only single link
++# Run the file command to find relevant non-stripped binaries, with bundle size of 32
++# Ignore all 'no machine' files
++# Only operate on non-stripped binaries
++
++strip_elf_binaries()
++{
++ local nlinks="${1}"
++ local nprocs="${2}"
++
++ find "$RPM_BUILD_ROOT" -type f \
++ ! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \
++ -links "${nlinks}" -print0 | \
++ xargs -0 -r -P${nprocs} -n${MAX_ARGS} sh -c "file \"\$@\" | \
++ sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | \
++ xargs -I\{\} $STRIP -g \{\}" ARG0
++}
++
++# strip all binaries with single link
++strip_elf_binaries "1" "${NCPUS}"
++
++# strip all binaries with more than 1 link
++strip_elf_binaries "+1" "1"
+--
+2.49.0
+
diff --git a/0002-Store-configurable-digest-s-on-packages-from-verific.patch b/0002-Store-configurable-digest-s-on-packages-from-verific.patch
new file mode 100644
index 0000000..a5b564b
--- /dev/null
+++ b/0002-Store-configurable-digest-s-on-packages-from-verific.patch
@@ -0,0 +1,454 @@
+From 434e40c9a08c7c4b7983a0ed47e7a2dd2ea705b2 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Wed, 9 Apr 2025 09:58:40 +0300
+Subject: [PATCH 2/3] Store configurable digest(s) on packages from
+ verification into the rpmdb
+
+It can be hard to reliably map packages in repositories to installed
+packages because the common repodata format only stores package-level
+checksums, whereas packages themselves cannot contain such a checksum
+for obvious reasons. The NEVRA information is nowhere near enough to
+uniquely identify a package. Technically of course, the repodata could
+be extended to carry header checksums but it seems that format is next
+to impossible to change, so...
+
+Having rpm calculate and store a configurable set of hashes has the
+benefit of serving as a cross-check that the package we installed was
+bit-per-bit identical to what was in the repository, even after the fact.
+
+Backported from commits:
+c0d84d40a94478e94943271dcc6c1213275dcf10
+cdf8ac7f07d75b941df90484684e87366e50cfe5
+49844e90bc352372b31035934fa51ff438c89a00
+a41a2c30cc9b0cc67d4d87c600cfdcec68751784
+55d22df4c8d7cf703d431ff6ebaa442275129e06 (without the test)
+
+Fixes: RHEL-35619
+---
+ doc/rpm.8 | 3 ++
+ lib/formats.c | 10 +++++
+ lib/psm.c | 21 +++++++++
+ lib/rpmtag.h | 2 +
+ lib/rpmtd.h | 1 +
+ lib/rpmte.c | 13 ++++++
+ lib/rpmte_internal.h | 3 ++
+ lib/transaction.c | 105 +++++++++++++++++++++++++++++++------------
+ macros.in | 17 +++++++
+ tests/rpmgeneral.at | 2 +
+ tests/rpmquery.at | 15 +++++++
+ tests/rpmsigdig.at | 36 +++++++++++++++
+ 12 files changed, 200 insertions(+), 28 deletions(-)
+
+diff --git a/doc/rpm.8 b/doc/rpm.8
+index ab7364cf6..6e5e85fba 100644
+--- a/doc/rpm.8
++++ b/doc/rpm.8
+@@ -508,6 +508,9 @@ Format file state.
+ \fB:fstatus\fR
+ Format file verify status.
+ .TP
++\fB:hashalgo\fR
++Display hash algorithm name.
++.TP
+ \fB:hex\fR
+ Format in hexadecimal.
+ .TP
+diff --git a/lib/formats.c b/lib/formats.c
+index 848f442e2..d6b4fb929 100644
+--- a/lib/formats.c
++++ b/lib/formats.c
+@@ -493,6 +493,14 @@ static char * humaniecFormat(rpmtd td, char **emsg)
+ return humanFormat(td, emsg, 1024);
+ }
+
++static char *hashalgoFormat(rpmtd td, char **emsg)
++{
++ const char *alg = pgpValString(PGPVAL_HASHALGO, rpmtdGetNumber(td));
++ if (rstreqn(alg, "Unknown", 7))
++ alg = "Unknown";
++ return rstrdup(alg);
++}
++
+ static const struct headerFmt_s rpmHeaderFormats[] = {
+ { RPMTD_FORMAT_STRING, "string",
+ RPM_ANY_CLASS, stringFormat },
+@@ -540,6 +548,8 @@ static const struct headerFmt_s rpmHeaderFormats[] = {
+ RPM_NUMERIC_CLASS, humansiFormat },
+ { RPMTD_FORMAT_HUMANIEC, "humaniec",
+ RPM_NUMERIC_CLASS, humaniecFormat },
++ { RPMTD_FORMAT_HASHALGO, "hashalgo",
++ RPM_NUMERIC_CLASS, hashalgoFormat },
+ { -1, NULL, 0, NULL }
+ };
+
+diff --git a/lib/psm.c b/lib/psm.c
+index 810323a45..b37e077a9 100644
+--- a/lib/psm.c
++++ b/lib/psm.c
+@@ -533,9 +533,26 @@ static void markReplacedInstance(rpmts ts, rpmte te)
+ rpmdbFreeIterator(mi);
+ }
+
++static void mergeAux(Header auxh, Header h)
++{
++ struct rpmtd_s td;
++ HeaderIterator hi = headerInitIterator(auxh);
++ while (headerNext(hi, &td)) {
++ /* Don't allow overwriting package data from aux */
++ if (headerIsEntry(h, td.tag))
++ continue;
++ if (rpmtdCount(&td) > 0) {
++ (void) headerPut(h, &td, HEADERPUT_DEFAULT);
++ }
++ rpmtdFreeData(&td);
++ }
++ headerFreeIterator(hi);
++}
++
+ static rpmRC dbAdd(rpmts ts, rpmte te)
+ {
+ Header h = rpmteHeader(te);
++ Header auxh = rpmteHeaderAux(te, 0);
+ rpm_time_t installTime = (rpm_time_t) time(NULL);
+ rpmfs fs = rpmteGetFileStates(te);
+ rpm_count_t fc = rpmfsFC(fs);
+@@ -552,6 +569,9 @@ static rpmRC dbAdd(rpmts ts, rpmte te)
+ headerPutUint32(h, RPMTAG_INSTALLTIME, &installTime, 1);
+ headerPutUint32(h, RPMTAG_INSTALLCOLOR, &tscolor, 1);
+
++ if (auxh)
++ mergeAux(auxh, h);
++
+ (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
+ rc = (rpmdbAdd(rpmtsGetRdb(ts), h) == 0) ? RPMRC_OK : RPMRC_FAIL;
+ (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
+@@ -561,6 +581,7 @@ static rpmRC dbAdd(rpmts ts, rpmte te)
+ packageHashAddEntry(ts->members->installedPackages,
+ headerGetInstance(h), te);
+ }
++ headerFree(auxh);
+ headerFree(h);
+ return rc;
+ }
+diff --git a/lib/rpmtag.h b/lib/rpmtag.h
+index 1fd829118..7a0740e00 100644
+--- a/lib/rpmtag.h
++++ b/lib/rpmtag.h
+@@ -377,6 +377,8 @@ typedef enum rpmTag_e {
+
+ /* Backports */
+ RPMTAG_SOURCELICENSE = 5102, /* internal */
++ RPMTAG_PACKAGEDIGESTS = 5118, /* s[] */
++ RPMTAG_PACKAGEDIGESTALGOS = 5119, /* i[] */
+
+ RPMTAG_FIRSTFREE_TAG /*!< internal */
+ } rpmTag;
+diff --git a/lib/rpmtd.h b/lib/rpmtd.h
+index 40779ae79..3887325da 100644
+--- a/lib/rpmtd.h
++++ b/lib/rpmtd.h
+@@ -245,6 +245,7 @@ typedef enum rpmtdFormats_e {
+ RPMTD_FORMAT_FSTATUS = 19, /* file verify status (int types) */
+ RPMTD_FORMAT_HUMANSI = 20, /* human readable value, K = 1000 (int types) */
+ RPMTD_FORMAT_HUMANIEC = 21, /* human readable value, K = 1024 (int types) */
++ RPMTD_FORMAT_HASHALGO = 25, /* digest algorithm name (int types) */
+ } rpmtdFormats;
+
+ /** \ingroup rpmtd
+diff --git a/lib/rpmte.c b/lib/rpmte.c
+index 0551a0fcc..492032ec5 100644
+--- a/lib/rpmte.c
++++ b/lib/rpmte.c
+@@ -30,6 +30,7 @@ struct rpmte_s {
+ rpmElementType type; /*!< Package disposition (installed/removed). */
+
+ Header h; /*!< Package header. */
++ Header auxh; /*!< Auxiliary data (from install) */
+ char * NEVR; /*!< Package name-version-release. */
+ char * NEVRA; /*!< Package name-version-release.arch. */
+ char * name; /*!< Name: */
+@@ -236,6 +237,7 @@ rpmte rpmteFree(rpmte te)
+ rpmfiFree(te->fi);
+ rpmfilesFree(te->files);
+ headerFree(te->h);
++ headerFree(te->auxh);
+ rpmfsFree(te->fs);
+ rpmpsFree(te->probs);
+ rpmteCleanDS(te);
+@@ -263,6 +265,17 @@ rpmte rpmteNew(rpmts ts, Header h, rpmElementType type, fnpyKey key,
+ return p;
+ }
+
++Header rpmteHeaderAux(rpmte te, int init)
++{
++ Header auxh = NULL;
++ if (te != NULL) {
++ if (te->auxh == NULL && init == 1)
++ te->auxh = headerNew();
++ auxh = headerLink(te->auxh);
++ }
++ return auxh;
++}
++
+ unsigned int rpmteDBInstance(rpmte te)
+ {
+ return (te != NULL ? te->db_instance : 0);
+diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h
+index 8a8b197f3..2de9b1de8 100644
+--- a/lib/rpmte_internal.h
++++ b/lib/rpmte_internal.h
+@@ -96,6 +96,9 @@ rpmfs rpmteGetFileStates(rpmte te);
+ RPM_GNUC_INTERNAL
+ void rpmteSetVerified(rpmte te, int verified);
+
++RPM_GNUC_INTERNAL
++Header rpmteHeaderAux(rpmte te, int init);
++
+ /** \ingroup rpmte
+ * Retrieve size in bytes of package header.
+ * @param te transaction element
+diff --git a/lib/transaction.c b/lib/transaction.c
+index 55bc2d961..d547b32b6 100644
+--- a/lib/transaction.c
++++ b/lib/transaction.c
+@@ -39,6 +39,7 @@
+ #include "lib/rpmts_internal.h"
+ #include "lib/rpmvs.h"
+ #include "rpmio/rpmhook.h"
++#include "rpmio/rpmio_internal.h"
+ #include "lib/rpmtriggers.h"
+
+ #include "lib/rpmplugins.h"
+@@ -1259,6 +1260,81 @@ static int vfyCb(struct rpmsinfo_s *sinfo, void *cbdata)
+ return (sinfo->rc == 0);
+ }
+
++static ARGI_t initPkgDigests(FD_t fd)
++{
++ ARGI_t ids = NULL;
++ char *digests = rpmExpand("%{?_pkgverify_digests}", NULL);
++ ARGV_t vals = argvSplitString(digests, ":", 0);
++
++ for (ARGV_t v = vals; v && *v; v++) {
++ uint32_t alg = atoi(*v);
++ if (alg) {
++ /* Try to ensure unique ids for the digests */
++ uint32_t id = (RPMTAG_PACKAGEDIGESTS << 16) | alg;
++ fdInitDigestID(fd, alg, id, 0);
++ argiAdd(&ids, -1, id);
++ }
++ }
++
++ argvFree(vals);
++ free(digests);
++ return ids;
++}
++
++static void finiPkgDigests(FD_t fd, ARGI_t ids, Header auxh)
++{
++ for (int i = 0; i < argiCount(ids); i++) {
++ char *pkgdig = NULL;
++ uint32_t id = argiData(ids)[i];
++ fdFiniDigest(fd, id, (void **)&pkgdig, NULL, 1);
++ if (pkgdig) {
++ uint32_t alg = 0xffff & id;
++ headerPutString(auxh, RPMTAG_PACKAGEDIGESTS, pkgdig);
++ headerPutUint32(auxh, RPMTAG_PACKAGEDIGESTALGOS, &alg, 1);
++ free(pkgdig);
++ }
++ }
++ argiFree(ids);
++}
++
++static int verifyPackage(rpmts ts, rpmte p, struct rpmvs_s *vs, int vfylevel)
++{
++ struct vfydata_s vd = {
++ .msg = NULL,
++ .type = { -1, -1, -1, },
++ .vfylevel = vfylevel,
++ };
++ int verified = 0;
++ rpmRC prc = RPMRC_FAIL;
++ Header auxh = rpmteHeaderAux(p, 1);
++
++ FD_t fd = rpmtsNotify(ts, p, RPMCALLBACK_INST_OPEN_FILE, 0, 0);
++ if (fd != NULL) {
++ ARGI_t ids = initPkgDigests(fd);
++ prc = rpmpkgRead(vs, fd, NULL, NULL, &vd.msg);
++ int test = rpmtsFlags(ts) & RPMTRANS_FLAG_TEST;
++ finiPkgDigests(fd, ids, (test || prc) ? NULL : auxh);
++ rpmtsNotify(ts, p, RPMCALLBACK_INST_CLOSE_FILE, 0, 0);
++ }
++
++ if (prc == RPMRC_OK)
++ prc = rpmvsVerify(vs, RPMSIG_VERIFIABLE_TYPE, vfyCb, &vd);
++
++ /* Record verify result */
++ if (vd.type[RPMSIG_SIGNATURE_TYPE] == RPMRC_OK)
++ verified |= RPMSIG_SIGNATURE_TYPE;
++ if (vd.type[RPMSIG_DIGEST_TYPE] == RPMRC_OK)
++ verified |= RPMSIG_DIGEST_TYPE;
++ rpmteSetVerified(p, verified);
++
++ if (prc)
++ rpmteAddProblem(p, RPMPROB_VERIFY, NULL, vd.msg, 0);
++
++ vd.msg = _free(vd.msg);
++ headerFree(auxh);
++ return prc;
++}
++
+ static int verifyPackageFiles(rpmts ts, rpm_loff_t total)
+ {
+ int rc = 0;
+@@ -1276,35 +1352,8 @@ static int verifyPackageFiles(rpmts ts, rpm_loff_t total)
+ pi = rpmtsiInit(ts);
+ while ((p = rpmtsiNext(pi, TR_ADDED))) {
+ struct rpmvs_s *vs = rpmvsCreate(vfylevel, vsflags, keyring);
+- struct vfydata_s vd = {
+- .msg = NULL,
+- .type = { -1, -1, -1, },
+- .vfylevel = vfylevel,
+- };
+- int verified = 0;
+- rpmRC prc = RPMRC_FAIL;
+-
+ rpmtsNotify(ts, p, RPMCALLBACK_VERIFY_PROGRESS, oc++, total);
+- FD_t fd = rpmtsNotify(ts, p, RPMCALLBACK_INST_OPEN_FILE, 0, 0);
+- if (fd != NULL) {
+- prc = rpmpkgRead(vs, fd, NULL, NULL, &vd.msg);
+- rpmtsNotify(ts, p, RPMCALLBACK_INST_CLOSE_FILE, 0, 0);
+- }
+-
+- if (prc == RPMRC_OK)
+- prc = rpmvsVerify(vs, RPMSIG_VERIFIABLE_TYPE, vfyCb, &vd);
+-
+- /* Record verify result */
+- if (vd.type[RPMSIG_SIGNATURE_TYPE] == RPMRC_OK)
+- verified |= RPMSIG_SIGNATURE_TYPE;
+- if (vd.type[RPMSIG_DIGEST_TYPE] == RPMRC_OK)
+- verified |= RPMSIG_DIGEST_TYPE;
+- rpmteSetVerified(p, verified);
+-
+- if (prc)
+- rpmteAddProblem(p, RPMPROB_VERIFY, NULL, vd.msg, 0);
+-
+- vd.msg = _free(vd.msg);
++ verifyPackage(ts, p, vs, vfylevel);
+ rpmvsFree(vs);
+ }
+ rpmtsNotify(ts, NULL, RPMCALLBACK_VERIFY_STOP, total, total);
+diff --git a/macros.in b/macros.in
+index fb899bf69..1674006cb 100644
+--- a/macros.in
++++ b/macros.in
+@@ -731,6 +731,23 @@ package or when debugging this package.\
+ # Disabler flags for package verification (similar to vsflags)
+ %_pkgverify_flags 0x0
+
++# A colon separated list of hash algorithms to calculate digests on the entire
++# package files during verification. The calculated digests are stored in the
++# Packagedigests tag of packages in the rpmdb, and the corresponding algorithms
++# in in the Packagedigestalgos tag. No package digests are calculated or stored
++# if --noverify is used during package installation.
++#
++# The following hash algorithms are known to rpm, but availability can vary
++# depending how rpm and it's underlying libraries have been built:
++#
++# 1 MD5 (obsolete)
++# 2 SHA1 (obsolete)
++# 8 SHA256
++# 9 SHA384
++# 10 SHA512
++#
++%_pkgverify_digests 8:10
++
+ # Minimize writes during transactions (at the cost of more reads) to
+ # conserve eg SSD disks (EXPERIMENTAL).
+ # 1 enable
+diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at
+index 8cc96e876..7cc284d4a 100644
+--- a/tests/rpmgeneral.at
++++ b/tests/rpmgeneral.at
+@@ -199,6 +199,8 @@ ORIGDIRNAMES
+ ORIGFILENAMES
+ OS
+ P
++PACKAGEDIGESTALGOS
++PACKAGEDIGESTS
+ PACKAGER
+ PATCH
+ PATCHESFLAGS
+diff --git a/tests/rpmquery.at b/tests/rpmquery.at
+index 92ad0955f..452a5ff12 100644
+--- a/tests/rpmquery.at
++++ b/tests/rpmquery.at
+@@ -351,6 +351,21 @@ runroot rpm \
+ ])
+ AT_CLEANUP
+
++AT_SETUP([hashalgo extension])
++AT_KEYWORDS([query digest])
++AT_CHECK([
++rpm -q \
++ --qf "%{filedigestalgo:hashalgo}\n" \
++ --qf "%{longsize:hashalgo}\n" \
++ "${RPMTEST}"/data/RPMS/hello-2.0-1.x86_64.rpm
++],
++[0],
++[SHA256
++Unknown
++],
++[])
++AT_CLEANUP
++
+ # ------------------------------
+ AT_SETUP([integer array perms format query])
+ AT_KEYWORDS([query])
+diff --git a/tests/rpmsigdig.at b/tests/rpmsigdig.at
+index 705fc5870..be4dbd5e2 100644
+--- a/tests/rpmsigdig.at
++++ b/tests/rpmsigdig.at
+@@ -565,3 +565,39 @@ POST-DELSIGN
+ ],
+ [])
+ AT_CLEANUP
++
++AT_SETUP([package verification digest])
++AT_KEYWORDS([install digest verify])
++
++AT_CHECK([
++RPMDB_INIT
++runroot rpm -U \
++ --define "_pkgverify_digests aa:bb:zz" \
++ --ignorearch --ignoreos --nodeps --nosignature --justdb \
++ /data/RPMS/hello-2.0-1.{i686,x86_64}.rpm
++
++runroot rpm -qa --qf "[[%{packagedigestalgos} %{packagedigests}\n]]" | sort -n
++],
++[0],
++[],
++[])
++
++AT_CHECK([
++RPMDB_INIT
++runroot rpm -U \
++ --define "_pkgverify_digests 2:8:12345:10" \
++ --ignorearch --ignoreos --nodeps --nosignature --justdb \
++ /data/RPMS/hello-2.0-1.{i686,x86_64}.rpm
++
++runroot rpm -qa --qf "[[%{packagedigestalgos:hashalgo} %{packagedigests}\n]]" | sort -n
++],
++[0],
++[SHA1 70d8bfc198823acdec9b3d793770e12ead6ae047
++SHA1 7299fad790a49e571a7ec4d60bef5d51597085fa
++SHA256 3328b90a578d18dba45abc584395795115c6c024abd561ce533ec175619925ff
++SHA256 e05a5191e214b1f05ae2448ebe493e55c6313ab68eaf040b83baa80e25f15d54
++SHA512 4db194ba2cb8b5e5cbb6f8d0dc1ec50be15cb20cdefa74b2b14a74032789b7411f4365dc4e69c7e3e37882f549d5f6e91b863eb51629e6ab72438e54b8eeedf5
++SHA512 5e0a11bf9c4f353b9197446d722e66cc322030e164929356e3fb669201597be77f3a44b4bd6f4fddf8746768809b43dae28f4fad1de315ef42a78e130847eb05
++],
++[])
++AT_CLEANUP
+--
+2.49.0
+
diff --git a/0003-Add-support-for-spec-local-file-attributes-and-gener.patch b/0003-Add-support-for-spec-local-file-attributes-and-gener.patch
new file mode 100644
index 0000000..3d2e80f
--- /dev/null
+++ b/0003-Add-support-for-spec-local-file-attributes-and-gener.patch
@@ -0,0 +1,141 @@
+From 373b50299468df8222c6dd5f2e62304531886102 Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Thu, 15 Feb 2024 09:26:38 +0200
+Subject: [PATCH 3/3] Add support for spec local file attributes and generators
+
+Allow declaring file attributes from the spec via %_local_file_attrs
+macro. This allows enabling file attributes and their dependency
+generators even if they are only shipped in the package itself and are
+not yet installed.
+
+The names need to be separated by colons (:).
+
+Co-authored-by: Florian Festi <ffesti@redhat.com>
+
+Backported from commits:
+d3b7b0e3280dbc66bd39cd851af32f16fd863f1b
+c167ef8bdaecdd2e306ec896c919607ba9cceb6f
+
+Fixes: RHEL-52772
+---
+ build/rpmfc.c | 32 +++++++++++++++++++++++------
+ tests/rpmbuild.at | 52 +++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 78 insertions(+), 6 deletions(-)
+
+diff --git a/build/rpmfc.c b/build/rpmfc.c
+index 10c380ee9..c3015ffcb 100644
+--- a/build/rpmfc.c
++++ b/build/rpmfc.c
+@@ -1115,20 +1115,40 @@ static int initAttrs(rpmfc fc)
+ ARGV_t files = NULL;
+ char * attrPath = rpmExpand("%{_fileattrsdir}/*.attr", NULL);
+ int nattrs = 0;
++ ARGV_t all_attrs = NULL;
+
+- /* Discover known attributes from pathnames + initialize them */
++ /* Discover known attributes from pathnames */
+ if (rpmGlob(attrPath, NULL, &files) == 0) {
+- nattrs = argvCount(files);
+- fc->atypes = xcalloc(nattrs + 1, sizeof(*fc->atypes));
+- for (int i = 0; i < nattrs; i++) {
++ int nfiles = argvCount(files);
++ for (int i = 0; i < nfiles; i++) {
+ char *bn = basename(files[i]);
+ bn[strlen(bn)-strlen(".attr")] = '\0';
+- fc->atypes[i] = rpmfcAttrNew(bn);
++ argvAdd(&all_attrs, bn);
+ }
+- fc->atypes[nattrs] = NULL;
+ argvFree(files);
+ }
++
++ /* Get file attributes from _local_file_attrs macro */
++ char * local_attr_names = rpmExpand("%{?_local_file_attrs}", NULL);
++ ARGV_t local_attrs = argvSplitString(local_attr_names, ":", ARGV_SKIPEMPTY);
++ int nlocals = argvCount(local_attrs);
++ for (int i = 0; i < nlocals; i++) {
++ argvAddUniq(&all_attrs, local_attrs[i]);
++ }
++
++ /* Initialize attr objects */
++ nattrs = argvCount(all_attrs);
++ fc->atypes = xcalloc(nattrs + 1, sizeof(*fc->atypes));
++
++ for (int i = 0; i < nattrs; i++) {
++ fc->atypes[i] = rpmfcAttrNew(all_attrs[i]);
++ }
++ fc->atypes[nattrs] = NULL;
++
+ free(attrPath);
++ free(local_attr_names);
++ argvFree(local_attrs);
++ argvFree(all_attrs);
+ return nattrs;
+ }
+
+diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
+index 2bc9c1e97..8d994ecaf 100644
+--- a/tests/rpmbuild.at
++++ b/tests/rpmbuild.at
+@@ -561,6 +561,58 @@ runroot rpm -qp --requires /build/RPMS/noarch/shebang-0.1-1.noarch.rpm|grep -v ^
+ [])
+ AT_CLEANUP
+
++AT_SETUP([Local dependency generator])
++AT_KEYWORDS([build])
++AT_CHECK([
++RPMDB_INIT
++
++runroot rpmbuild -bb --quiet \
++ --define '_local_file_attrs my_test_attr' \
++ --define '__my_test_attr_provides() foo(%{basename:%{1}})' \
++ --define '__my_test_attr_path .*' \
++ /data/SPECS/shebang.spec
++runroot rpm -qp --provides /build/RPMS/noarch/shebang-0.1-1.noarch.rpm|grep -v ^rpmlib
++],
++[0],
++[foo(shebang)
++shebang = 0.1-1
++],
++[])
++
++AT_CHECK([
++RPMDB_INIT
++
++runroot rpmbuild -bb --quiet \
++ --define '_local_file_attrs script' \
++ --define '__script_provides() foobar(%{basename:%{1}})' \
++ /data/SPECS/shebang.spec
++runroot rpm -qp --provides /build/RPMS/noarch/shebang-0.1-1.noarch.rpm|grep -v ^rpmlib
++],
++[0],
++[foobar(shebang)
++shebang = 0.1-1
++],
++[])
++
++AT_CHECK([
++RPMDB_INIT
++
++runroot rpmbuild -bb --quiet \
++ --define '_local_file_attrs my_test_attr:script' \
++ --define '__my_test_attr_provides() foo(%{basename:%{1}})' \
++ --define '__my_test_attr_path .*' \
++ --define '__script_provides() foobar(%{basename:%{1}})' \
++ /data/SPECS/shebang.spec
++runroot rpm -qp --provides /build/RPMS/noarch/shebang-0.1-1.noarch.rpm|grep -v ^rpmlib
++],
++[0],
++[foo(shebang)
++foobar(shebang)
++shebang = 0.1-1
++],
++[])
++AT_CLEANUP
++
+ # ------------------------------
+ # Test spec query functionality
+ AT_SETUP([rpmspec query 1])
+--
+2.49.0
+
diff --git a/python3-rpm.spec b/python3-rpm.spec
index 4d771c7..21f0240 100644
--- a/python3-rpm.spec
+++ b/python3-rpm.spec
@@ -31,7 +31,7 @@
%global rpmver 4.16.1.3
#global snapver rc1
-%global rel 37
+%global rel 39
%global sover 9
%global rhelrel %{?snapver:0.%{snapver}.}%{rel}
%global rel_next %{lua:print(tonumber(rpm.expand("%rel")) + 1)}
@@ -122,6 +122,10 @@ Patch148: 0001-Talk-about-rpmsign-in-the-rpmsign-man-page.patch
Patch149: 0001-Allow-parametric-macros-to-opt-out-of-option-process.patch
Patch150: 0001-Report-unsafe-symlinks-during-installation-as-a-spec.patch
Patch151: 0002-Fix-FA_TOUCH-ed-files-getting-removed-on-failed-upda.patch
+Patch152: 0001-Fix-a-race-condition-in-brp-strip.patch
+Patch153: 0002-Store-configurable-digest-s-on-packages-from-verific.patch
+Patch154: 0003-Add-support-for-spec-local-file-attributes-and-gener.patch
+Patch155: 0001-Allow-an-optional-override-clock-for-deterministic-t.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -407,6 +411,9 @@ make clean
%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
%changelog
+* Wed Aug 20 2025 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-39
+- Allow an optional "override clock" for deterministic timestamps (RHEL-106672)
+
* Thu Jul 03 2025 Miro Hrončok <mhroncok@redhat.com> - 4.16.1.3-37.1
- Add python3.13-rpm
^ permalink raw reply related [flat|nested] 6+ messages in thread* [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
@ 2026-11-13 19:46
0 siblings, 0 replies; 6+ messages in thread
From: @ 2026-11-13 19:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9-next
Commit : e64f2d8ccd93ec1d5f91826e7e4aca5a8e2a7401
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2026-06-04T17:04:00+02:00
Stats : +254/-2 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/python3-rpm/c/e64f2d8ccd93ec1d5f91826e7e4aca5a8e2a7401?branch=epel9-next
Log:
Merge epel9-next into epel9
---
diff --git a/0001-Improve-error-handling-on-keystore-load.patch b/0001-Improve-error-handling-on-keystore-load.patch
new file mode 100644
index 0000000..8d16b69
--- /dev/null
+++ b/0001-Improve-error-handling-on-keystore-load.patch
@@ -0,0 +1,168 @@
+From 38ccf257f278e6b71f73dee9ccb568fe2ad3037a Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Fri, 31 Oct 2025 11:21:28 +0100
+Subject: [PATCH 1/2] Obtain nvr string only once, before the loop
+
+Refactor loadKeyringFromDB() a bit so that the nvr string can be reused
+in multiple places. This will be handy in the next commit.
+
+No functional change.
+---
+ lib/rpmts.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/lib/rpmts.c b/lib/rpmts.c
+index 69888acfc..ceb021789 100644
+--- a/lib/rpmts.c
++++ b/lib/rpmts.c
+@@ -327,10 +327,12 @@ static int loadKeyringFromDB(rpmts ts)
+ while ((h = rpmdbNextIterator(mi)) != NULL) {
+ struct rpmtd_s pubkeys;
+ const char *key;
++ char *nvr;
+
+ if (!headerGet(h, RPMTAG_PUBKEYS, &pubkeys, HEADERGET_MINMEM))
+ continue;
+
++ nvr = headerGetAsString(h, RPMTAG_NVR);
+ while ((key = rpmtdNextString(&pubkeys))) {
+ uint8_t *pkt;
+ size_t pktlen;
+@@ -341,9 +343,7 @@ static int loadKeyringFromDB(rpmts ts)
+ rpmPubkey *subkeys = rpmGetSubkeys(key, &subkeysCount);
+
+ if (rpmKeyringAddKey(ts->keyring, key) == 0) {
+- char *nvr = headerGetAsString(h, RPMTAG_NVR);
+ rpmlog(RPMLOG_DEBUG, "added key %s to keyring\n", nvr);
+- free(nvr);
+ nkeys++;
+ }
+ rpmPubkeyFree(key);
+@@ -352,12 +352,10 @@ static int loadKeyringFromDB(rpmts ts)
+ rpmPubkey subkey = subkeys[i];
+
+ if (rpmKeyringAddKey(ts->keyring, subkey) == 0) {
+- char *nvr = headerGetAsString(h, RPMTAG_NVR);
+ rpmlog(RPMLOG_DEBUG,
+ "added subkey %d of main key %s to keyring\n",
+ i, nvr);
+
+- free(nvr);
+ nkeys++;
+ }
+ rpmPubkeyFree(subkey);
+@@ -367,6 +365,7 @@ static int loadKeyringFromDB(rpmts ts)
+ }
+ }
+ rpmtdFreeData(&pubkeys);
++ free(nvr);
+ }
+ rpmdbFreeIterator(mi);
+
+--
+2.51.1
+
+
+From c68a557146c594458fb00109863565651cbe8f0a Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Fri, 31 Oct 2025 14:17:25 +0100
+Subject: [PATCH 2/2] Improve error handling on keystore load
+
+Report a failure to load a key, but only as a non-fatal warning so that
+other keys can still be loaded, if any. This behavior is in the spirit
+of #3996, too.
+
+Only emit *one* warning in the keystore_rpmdb, to keep the (code) noise
+down. This covers all three steps (rpmBase64Decode, rpmPubkeyNew and
+rpmKeyringAddKey). We don't need to check if key is NULL since that's
+handled by rpmKeyringAddKey() which returns immediately if that's the
+case.
+
+In the other two backends, we already handle a failure to *read* a key,
+so keep that and just add another warning for a failed addition.
+
+This would be difficult to test (especially in the rpmdb backend) so
+skimping on that here.
+
+(backported from commit 75de4f3eb28c686e7f73b750ca116a8e57b7a690)
+---
+ lib/rpmts.c | 18 +++++++++++++++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/lib/rpmts.c b/lib/rpmts.c
+index ceb021789..f6fe38c7a 100644
+--- a/lib/rpmts.c
++++ b/lib/rpmts.c
+@@ -281,6 +281,7 @@ static int loadKeyringFromFiles(rpmts ts)
+ }
+
+ for (char **f = files; *f; f++) {
++ int rc = 1;
+ int subkeysCount, i;
+ rpmPubkey *subkeys;
+ rpmPubkey key = rpmPubkeyRead(*f);
+@@ -289,7 +290,7 @@ static int loadKeyringFromFiles(rpmts ts)
+ rpmlog(RPMLOG_ERR, _("%s: reading of public key failed.\n"), *f);
+ continue;
+ }
+- if (rpmKeyringAddKey(ts->keyring, key) == 0) {
++ if ((rc = rpmKeyringAddKey(ts->keyring, key)) == 0) {
+ nkeys++;
+ rpmlog(RPMLOG_DEBUG, "added key %s to keyring\n", *f);
+ }
+@@ -305,10 +306,15 @@ static int loadKeyringFromFiles(rpmts ts)
+ i, *f);
+
+ nkeys++;
++ } else {
++ rc = 1;
+ }
+ rpmPubkeyFree(subkey);
+ }
+ free(subkeys);
++
++ if (rc)
++ rpmlog(RPMLOG_WARNING, _("Could not load key %s\n"), *f);
+ }
+ exit:
+ free(pkpath);
+@@ -334,15 +340,16 @@ static int loadKeyringFromDB(rpmts ts)
+
+ nvr = headerGetAsString(h, RPMTAG_NVR);
+ while ((key = rpmtdNextString(&pubkeys))) {
++ int rc = 1;
+ uint8_t *pkt;
+ size_t pktlen;
+
+- if (rpmBase64Decode(key, (void **) &pkt, &pktlen) == 0) {
++ if ((rc = rpmBase64Decode(key, (void **) &pkt, &pktlen)) == 0) {
+ rpmPubkey key = rpmPubkeyNew(pkt, pktlen);
+ int subkeysCount, i;
+ rpmPubkey *subkeys = rpmGetSubkeys(key, &subkeysCount);
+
+- if (rpmKeyringAddKey(ts->keyring, key) == 0) {
++ if ((rc = rpmKeyringAddKey(ts->keyring, key)) == 0) {
+ rpmlog(RPMLOG_DEBUG, "added key %s to keyring\n", nvr);
+ nkeys++;
+ }
+@@ -357,12 +364,17 @@ static int loadKeyringFromDB(rpmts ts)
+ i, nvr);
+
+ nkeys++;
++ } else {
++ rc = 1;
+ }
+ rpmPubkeyFree(subkey);
+ }
+ free(subkeys);
+ free(pkt);
+ }
++
++ if (rc)
++ rpmlog(RPMLOG_WARNING, _("Could not load key %s\n"), nvr);
+ }
+ rpmtdFreeData(&pubkeys);
+ free(nvr);
+--
+2.51.1
+
diff --git a/0001-Sort-files-before-passing-to-file-attribute-dependen.patch b/0001-Sort-files-before-passing-to-file-attribute-dependen.patch
new file mode 100644
index 0000000..0f4c312
--- /dev/null
+++ b/0001-Sort-files-before-passing-to-file-attribute-dependen.patch
@@ -0,0 +1,61 @@
+From 08d5e162c2ec3a415a5e657fd8b63f0cdf14ddd8 Mon Sep 17 00:00:00 2001
+From: Chris Riches <chris.riches@nutanix.com>
+Date: Thu, 5 Jun 2025 09:47:02 +0000
+Subject: [PATCH] Sort files before passing to file attribute dependency
+ generators
+
+The fc->fahash map is constructed in parallel, and so ends up with
+non-deterministic ordering of files. Passing this unordered list through
+to file attribute dependency generators can therefore result in
+non-reproducible RPM builds.
+
+In theory, a file attribute generator should only care about each
+individual file it is given, and so the order should not matter.
+However, some generators track state in-between files and so this
+property does not hold. Notably, the python3-rpm-generators in RHEL
+(ab)use this system to apply package-level dependencies that are based
+on the package name rather than the content of any particular file, and
+simply apply this to the first file that they see from a matching
+package. Therefore, different input file orderings will result in
+different files getting the dependency, and therefore different output
+RPMs.
+
+To avoid this, sort the files before passing them to the generators.
+Since the fc->fn array is already sorted by filename, we just need to
+sort the list of indices into that array.
+
+(backported from commit bc0b94026bc5651435819043394cbe9a766a4fd5)
+---
+ build/rpmfc.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/build/rpmfc.c b/build/rpmfc.c
+index c3015ffcb..b5fb611db 100644
+--- a/build/rpmfc.c
++++ b/build/rpmfc.c
+@@ -1010,6 +1010,13 @@ static const struct applyDep_s applyDepTable[] = {
+ { 0, 0, NULL },
+ };
+
++static int compareInts(const void *a, const void *b)
++{
++ int ia = *((int*)a);
++ int ib = *((int*)b);
++ return ia > ib ? 1 : ia < ib ? -1 : 0;
++}
++
+ static int applyAttr(rpmfc fc, int aix, const char *aname,
+ const struct exclreg_s *excl,
+ const struct applyDep_s *dep)
+@@ -1032,6 +1039,8 @@ static int applyAttr(rpmfc fc, int aix, const char *aname,
+
+ if (!rstreq(cmd, "")) {
+ char *ns = rpmfcAttrMacro(aname, "namespace", NULL);
++ /* Sort for reproducibility - hashmap was constructed in parallel */
++ qsort(ixs, n, sizeof(*ixs), compareInts);
+ for (int i = 0; i < n; i++) {
+ if (rpmfcHelper(fc, ixs[i], excl, dep->type, dep->tag,
+ ns, cmd, callable))
+--
+2.51.1
+
diff --git a/python3-rpm.spec b/python3-rpm.spec
index 21f0240..7330b95 100644
--- a/python3-rpm.spec
+++ b/python3-rpm.spec
@@ -31,14 +31,14 @@
%global rpmver 4.16.1.3
#global snapver rc1
-%global rel 39
+%global rel 40
%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 1
+%global baserelease 2
%global srcver %{rpmver}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:rpm-%(echo %{rpmver} | cut -d'.' -f1-2).x}
@@ -126,6 +126,8 @@ Patch152: 0001-Fix-a-race-condition-in-brp-strip.patch
Patch153: 0002-Store-configurable-digest-s-on-packages-from-verific.patch
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
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -241,6 +243,8 @@ programs that will manipulate RPM packages and databases.}
%python3x_package
%global python3_pkgversion 3.13
%python3x_package
+%global python3_pkgversion 3.14
+%python3x_package
%prep
%autosetup -n rpm-%{srcver} %{?with_int_bdb:-a 1} -p1
@@ -305,6 +309,8 @@ pushd python
%py3_build
%global python3_pkgversion 3.13
%py3_build
+%global python3_pkgversion 3.14
+%py3_build
popd
%install
@@ -319,6 +325,8 @@ pushd python
%py3_install
%global python3_pkgversion 3.13
%py3_install
+%global python3_pkgversion 3.14
+%py3_install
popd
cat > $RPM_BUILD_ROOT/%{rpmhome}/debugedit << END
@@ -386,6 +394,8 @@ rm -r %{buildroot}%{_sysconfdir}
%py3_check_import rpm rpm.transaction
%global python3_pkgversion 3.13
%py3_check_import rpm rpm.transaction
+%global python3_pkgversion 3.14
+%py3_check_import rpm rpm.transaction
%if %{with check}
make check TESTSUITEFLAGS=-j%{_smp_build_ncpus} || (cat tests/rpmtests.log; exit 1)
# rpm >= 4.16.0 testsuite leaves a read-only tree behind, clean it up
@@ -410,7 +420,20 @@ make clean
%{python3_sitearch}/rpm/
%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
+%global python3_pkgversion 3.14
+%files -n python%{python3_pkgversion}-rpm
+%license COPYING
+%{python3_sitearch}/rpm/
+%{python3_sitearch}/rpm-%{rpmver}*.egg-info/
+
%changelog
+* Tue Mar 17 2026 Miro Hrončok <mhroncok@redhat.com> - 4.16.1.3-40.2
+- Add python3.14-rpm
+
+* Fri Nov 21 2025 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-40
+- Improve error handling on keystore load (RHEL-114837)
+- Sort files before passing to file attr dependency generators (RHEL-95376)
+
* Wed Aug 20 2025 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-39
- Allow an optional "override clock" for deterministic timestamps (RHEL-106672)
^ permalink raw reply related [flat|nested] 6+ messages in thread* [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
@ 2026-11-13 19:46
0 siblings, 0 replies; 6+ messages in thread
From: @ 2026-11-13 19:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python3-rpm
Branch : epel9-next
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-next
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-13 19:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13 19:46 [rpms/python3-rpm] epel9-next: Merge epel9-next into epel9
2026-11-13 19:46
2026-11-13 19:46
2026-11-13 19:46
2026-11-13 19:46
2026-11-13 19:46
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox