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