From 0bccf0ecf6ac3f7ebecb26f6c5c92ee52049d43a9012e5d51dc00409796e7d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 19 Dec 2024 14:27:36 +0000 Subject: [PATCH] - backport debug_package regression fix from upstream - fix segfault in rpmtsNextFiles OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=683 --- debugpackage.diff | 17 +++++++++++++++++ nextfiles.diff | 40 ++++++++++++++++++++++++++++++++++++++++ rpm.changes | 8 ++++++++ rpm.spec | 4 +++- 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 debugpackage.diff create mode 100644 nextfiles.diff diff --git a/debugpackage.diff b/debugpackage.diff new file mode 100644 index 0000000..88bf975 --- /dev/null +++ b/debugpackage.diff @@ -0,0 +1,17 @@ +--- macros.in.orig 2024-12-19 13:27:56.291657815 +0000 ++++ macros.in 2024-12-19 13:29:00.335537654 +0000 +@@ -199,11 +199,12 @@ package or when debugging this package.\ + %{nil} + + # The duplicate __debug_package definition is needed to ensure matching +-# state when %install is skipped due to short-circuit. ++# state when %install is skipped due to short-circuit, IFF buildsubdir ++# is defined (indicating use of automatic debuginfo generation) + %debug_package \ + %ifnarch noarch\ + %global __debug_package 1\ +-%%global __debug_package 1\ ++%{?buildsubdir:%%global __debug_package 1}\ + %_debuginfo_template\ + %{?_debugsource_packages:%_debugsource_template}\ + %endif\ diff --git a/nextfiles.diff b/nextfiles.diff new file mode 100644 index 0000000..76d32e8 --- /dev/null +++ b/nextfiles.diff @@ -0,0 +1,40 @@ +--- lib/rpmtriggers.c.orig 2024-12-19 14:05:56.403437646 +0000 ++++ lib/rpmtriggers.c 2024-12-19 14:11:56.646774439 +0000 +@@ -239,31 +239,33 @@ typedef struct matchFilesIter_s { + static rpmfiles rpmtsNextFiles(matchFilesIter mfi) + { + Header h; +- rpmte *te; + rpmfiles files = NULL; ++ const char *pkgname = NULL; + rpmstrPool pool = mfi->ts->members->pool; + int ix; +- unsigned int offset; + + ix = rpmdbGetIteratorIndex(mfi->pi); + if (ix < rpmdbGetIteratorCount(mfi->pi)) { +- offset = rpmdbGetIteratorOffsetFor(mfi->pi, ix); ++ unsigned int offset = rpmdbGetIteratorOffsetFor(mfi->pi, ix); ++ rpmte *te; + if (packageHashGetEntry(mfi->ts->members->removedPackages, offset, + &te, NULL, NULL)) { + /* Files are available in memory */ + files = rpmteFiles(te[0]); ++ pkgname = rpmteN(te[0]); + } + + if (packageHashGetEntry(mfi->ts->members->installedPackages, offset, + &te, NULL, NULL)) { + /* Files are available in memory */ + files = rpmteFiles(te[0]); ++ pkgname = rpmteN(te[0]); + } + } + + if (files) { + rpmdbSetIteratorIndex(mfi->pi, ix + 1); +- mfi->pkgname = rpmteN(te[0]); ++ mfi->pkgname = pkgname; + } else { + /* Files are not available in memory. Read them from rpmdb */ + h = rpmdbNextIterator(mfi->pi); diff --git a/rpm.changes b/rpm.changes index 93616be..8a6250e 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Dec 19 14:29:49 CET 2024 - mls@suse.de + +- backport debug_package regression fix from upstream + * new patch: debugpackage.diff +- fix segfault in rpmtsNextFiles + * new patch: nextfiles.diff + ------------------------------------------------------------------- Tue Dec 17 10:59:26 CET 2024 - mls@suse.de diff --git a/rpm.spec b/rpm.spec index 931645d..2e80a69 100644 --- a/rpm.spec +++ b/rpm.spec @@ -121,6 +121,8 @@ Patch141: 0002-log-build-time-if-it-is-set-from-SOURCE_DATE_EPOCH.patch Patch142: 0003-Error-out-on-a-missing-changelog-date.patch Patch150: unshare.diff Patch151: buildroot-symlink.diff +Patch152: debugpackage.diff +Patch153: nextfiles.diff Patch6464: auto-config-update-aarch64-ppc64le.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -235,7 +237,7 @@ rm -rf sqlite %patch -P 140 %endif %patch -P 141 -P 142 -%patch -P 150 -P 151 +%patch -P 150 -P 151 -P 152 -P 153 %ifarch aarch64 ppc64le riscv64 %patch -P 6464