public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Really fix spurious %%transfiletriggerpostun execution (#2023311, #2048168)
@ 2026-11-23  9:34 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23  9:34 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/rpm
Branch : pmatilai-v6
Commit : 7fefa01b9e2ad188c4e7db56c814ae4040e328b7
Author : Panu Matilainen <pmatilai@redhat.com>
Date   : 2022-02-02T14:05:21+02:00
Stats  : +69/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rpm/c/7fefa01b9e2ad188c4e7db56c814ae4040e328b7?branch=pmatilai-v6

Log:
Really fix spurious %%transfiletriggerpostun execution (#2023311, #2048168)

---
diff --git a/0001-Really-fix-spurious-transfiletriggerpostun-execution.patch b/0001-Really-fix-spurious-transfiletriggerpostun-execution.patch
new file mode 100644
index 0000000..72f42b6
--- /dev/null
+++ b/0001-Really-fix-spurious-transfiletriggerpostun-execution.patch
@@ -0,0 +1,64 @@
+From 2d85f74afc3ccfa584dd8f0981673ff2b06277d1 Mon Sep 17 00:00:00 2001
+Message-Id: <2d85f74afc3ccfa584dd8f0981673ff2b06277d1.1643803240.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Wed, 2 Feb 2022 13:46:23 +0200
+Subject: [PATCH] Really fix spurious %transfiletriggerpostun execution
+ (RhBug:2023311)
+
+Commit b3d672a5523dfec033160e5cc866432a0e808649 got the base reasoning
+in the ballpark but the code all wrong, introducing a severe performance
+regression without actually fixing what it claimed to.
+
+The missing incredient is actually comparing the current prefix with the
+triggers in matched package (trying to describe this makes my head
+spin): a package may have multiple triggers on multiple prefixes and
+we need to make sure we only execute triggers of this type, from this
+prefix.
+
+Fixes: b3d672a5523dfec033160e5cc866432a0e808649
+---
+ lib/rpmtriggers.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/lib/rpmtriggers.c b/lib/rpmtriggers.c
+index 6fe4db65d..3f8fa22d0 100644
+--- a/lib/rpmtriggers.c
++++ b/lib/rpmtriggers.c
+@@ -97,14 +97,16 @@ static void rpmtriggersSortAndUniq(rpmtriggers trigs)
+     }
+ }
+ 
+-static void addTriggers(rpmts ts, Header trigH, rpmsenseFlags filter)
++static void addTriggers(rpmts ts, Header trigH, rpmsenseFlags filter,
++			const char *prefix)
+ {
+     int tix = 0;
+     rpmds ds;
+     rpmds triggers = rpmdsNew(trigH, RPMTAG_TRANSFILETRIGGERNAME, 0);
+ 
+     while ((ds = rpmdsFilterTi(triggers, tix))) {
+-	if ((rpmdsNext(ds) >= 0) && (rpmdsFlags(ds) & filter)) {
++	if ((rpmdsNext(ds) >= 0) && (rpmdsFlags(ds) & filter) &&
++		strcmp(prefix, rpmdsN(ds)) == 0) {
+ 	    struct rpmtd_s priorities;
+ 
+ 	    if (headerGet(trigH, RPMTAG_TRANSFILETRIGGERPRIORITIES,
+@@ -141,12 +143,13 @@ void rpmtriggersPrepPostUnTransFileTrigs(rpmts ts, rpmte te)
+ 	    if (RPMFILE_IS_INSTALLED(rpmfiFState(fi))) {
+ 		unsigned int npkg = rpmdbIndexIteratorNumPkgs(ii);
+ 		const unsigned int *offs = rpmdbIndexIteratorPkgOffsets(ii);
+-		/* Save any matching postun triggers */
++		/* Save any postun triggers matching this prefix */
+ 		for (int i = 0; i < npkg; i++) {
+ 		    Header h = rpmdbGetHeaderAt(rpmtsGetRdb(ts), offs[i]);
+-		    addTriggers(ts, h, RPMSENSE_TRIGGERPOSTUN);
++		    addTriggers(ts, h, RPMSENSE_TRIGGERPOSTUN, pfx);
+ 		    headerFree(h);
+ 		}
++		break;
+ 	    }
+ 	}
+ 	rpmfiFree(fi);
+-- 
+2.34.1
+

diff --git a/rpm.spec b/rpm.spec
index 3cc2a04..566875d 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -30,7 +30,7 @@
 
 %global rpmver 4.17.0
 #global snapver rc1
-%global baserelease 7
+%global baserelease 8
 %global sover 9
 
 %global srcver %{rpmver}%{?snapver:-%{snapver}}
@@ -57,6 +57,7 @@ Patch3: rpm-4.9.90-no-man-dirs.patch
 
 # Patches already upstream:
 Patch100: 0001-Fix-spurious-transfiletriggerpostun-execution-RhBug-.patch
+Patch101: 0001-Really-fix-spurious-transfiletriggerpostun-execution.patch
 
 # These are not yet upstream
 Patch906: rpm-4.7.1-geode-i686.patch
@@ -606,6 +607,9 @@ fi
 %doc docs/librpm/html/*
 
 %changelog
+* Wed Feb 02 2022 Panu Matilainen <pmatilai@redhat.com> - 4.17.0-8
+- Really fix spurious %%transfiletriggerpostun execution (#2023311, #2048168)
+
 * Wed Jan 26 2022 Neal Gompa <ngompa@fedoraproject.org> - 4.17.0-7
 - Migrate rpmdb to /usr/lib/sysimage/rpm (#2042099)
   https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:34 [rpms/rpm] pmatilai-v6: Really fix spurious %%transfiletriggerpostun execution (#2023311, #2048168) Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox