[Rpm-maint] [rpm-software-management/rpm] transfiletriggerpostun doesn't work when rpms are removed. (Issue #2324)

xiacunshun notifications at github.com
Fri Dec 16 15:38:22 UTC 2022


I try to fix this by putting `rpmdsNext` into a loop, and it seems to work.
But I don't know whether it's the right way.
`
diff -uprN rpm-4.17.1.orig/lib/rpmtriggers.c rpm-4.17.1/lib/rpmtriggers.c
--- rpm-4.17.1.orig/lib/rpmtriggers.c   2022-12-16 16:40:08.442304317 +0800
+++ rpm-4.17.1/lib/rpmtriggers.c        2022-12-16 22:53:23.272284885 +0800
@@ -105,15 +105,16 @@ static void addTriggers(rpmts ts, Header
     rpmds triggers = rpmdsNew(trigH, RPMTAG_TRANSFILETRIGGERNAME, 0);
 
     while ((ds = rpmdsFilterTi(triggers, tix))) {
-       if ((rpmdsNext(ds) >= 0) && (rpmdsFlags(ds) & filter) &&
-               strcmp(prefix, rpmdsN(ds)) == 0) {
-           struct rpmtd_s priorities;
+       while (rpmdsNext(ds) >= 0) {
+            if ((rpmdsFlags(ds) & filter) && strcmp(prefix, rpmdsN(ds)) == 0) {
+               struct rpmtd_s priorities;
 
-           if (headerGet(trigH, RPMTAG_TRANSFILETRIGGERPRIORITIES,
+               if (headerGet(trigH, RPMTAG_TRANSFILETRIGGERPRIORITIES,
                        &priorities, HEADERGET_MINMEM)) {
-               rpmtdSetIndex(&priorities, tix);
-               rpmtriggersAdd(ts->trigs2run, headerGetInstance(trigH),
+                   rpmtdSetIndex(&priorities, tix);
+                   rpmtriggersAdd(ts->trigs2run, headerGetInstance(trigH),
                                tix, *rpmtdGetUint32(&priorities));
+                }
            }
        }
        rpmdsFree(ds);
`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2324#issuecomment-1355095980
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/2324/1355095980 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20221216/eba33ceb/attachment-0001.html>


More information about the Rpm-maint mailing list