From 3bf18080b55502c55b1698c4b3fc889a6bd0dee5 Mon Sep 17 00:00:00 2001 From: Lubos Kardos Date: Nov 23 2015 15:16:27 +0000 Subject: - Add possibility to disable file triggers - Fix unwanted multiple execution of file triggers in dnf - Resolves: #1282115 --- diff --git a/rpm-4.13.0-disabling-filetriggers.patch b/rpm-4.13.0-disabling-filetriggers.patch new file mode 100644 index 0000000..b9d1e5e --- /dev/null +++ b/rpm-4.13.0-disabling-filetriggers.patch @@ -0,0 +1,212 @@ +From 31996808c140496c35e3c9543750026292b72287 Mon Sep 17 00:00:00 2001 +From: Lubos Kardos +Date: Mon, 23 Nov 2015 15:05:13 +0100 +Subject: [PATCH] Add possibility to disable file triggers. + +Now options --notriggers, --notriggerin, --notriggerun, --notriggerpostun +disable also file triggers and not only normal trigges. Transaction file +triggers can be also disabled with --nopretrans and --nopostrans options. + +Before this patch file triggers weren't disabled when option --test was +specified. That caused unwanted multiple execution of file triggers +in dnf because dnf executes transaction with flag test before executing +transaction for real (rhbz:1282115). +--- + lib/psm.c | 97 ++++++++++++++++++++++++++++++------------------------- + lib/transaction.c | 16 ++++++--- + 2 files changed, 65 insertions(+), 48 deletions(-) + +diff --git a/lib/psm.c b/lib/psm.c +index 154237e..08d4919 100644 +--- a/lib/psm.c ++++ b/lib/psm.c +@@ -682,21 +682,24 @@ static rpmRC rpmPackageInstall(rpmts ts, rpmpsm psm) + rc = dbAdd(ts, psm->te); + if (rc) break; + +- /* Run upper file triggers i. e. with higher priorities */ +- /* Run file triggers in other package(s) this package sets off. */ +- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, +- RPMSCRIPT_FILETRIGGER, 1); +- if (rc) break; +- +- /* Run file triggers in this package other package(s) set off. */ +- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, ++ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERIN)) { ++ /* Run upper file triggers i. e. with higher priorities */ ++ /* Run file triggers in other package(s) this package sets off. */ ++ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, + RPMSCRIPT_FILETRIGGER, 1); +- if (rc) break; ++ if (rc) break; ++ ++ /* Run file triggers in this package other package(s) set off. */ ++ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, ++ RPMSCRIPT_FILETRIGGER, 1); ++ if (rc) break; ++ } + + if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOST)) { + rc = runInstScript(psm, RPMTAG_POSTIN); + if (rc) break; + } ++ + if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERIN)) { + /* Run triggers in other package(s) this package sets off. */ + rc = runTriggers(psm, RPMSENSE_TRIGGERIN); +@@ -705,18 +708,18 @@ static rpmRC rpmPackageInstall(rpmts ts, rpmpsm psm) + /* Run triggers in this package other package(s) set off. */ + rc = runImmedTriggers(psm, RPMSENSE_TRIGGERIN); + if (rc) break; +- } + +- /* Run lower file triggers i. e. with lower priorities */ +- /* Run file triggers in other package(s) this package sets off. */ +- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, +- RPMSCRIPT_FILETRIGGER, 2); +- if (rc) break; +- +- /* Run file triggers in this package other package(s) set off. */ +- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, ++ /* Run lower file triggers i. e. with lower priorities */ ++ /* Run file triggers in other package(s) this package sets off. */ ++ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, + RPMSCRIPT_FILETRIGGER, 2); +- if (rc) break; ++ if (rc) break; ++ ++ /* Run file triggers in this package other package(s) set off. */ ++ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN, ++ RPMSCRIPT_FILETRIGGER, 2); ++ if (rc) break; ++ } + + rc = markReplacedFiles(psm); + } +@@ -734,17 +737,17 @@ static rpmRC rpmPackageErase(rpmts ts, rpmpsm psm) + rpmswEnter(rpmtsOp(psm->ts, RPMTS_OP_ERASE), 0); + while (once--) { + +- /* Run file triggers in this package other package(s) set off. */ +- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, +- RPMSCRIPT_FILETRIGGER, 1); +- if (rc) break; ++ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) { ++ /* Run file triggers in this package other package(s) set off. */ ++ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, ++ RPMSCRIPT_FILETRIGGER, 1); ++ if (rc) break; + +- /* Run file triggers in other package(s) this package sets off. */ +- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, +- RPMSCRIPT_FILETRIGGER, 1); +- if (rc) break; ++ /* Run file triggers in other package(s) this package sets off. */ ++ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, ++ RPMSCRIPT_FILETRIGGER, 1); ++ if (rc) break; + +- if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) { + /* Run triggers in this package other package(s) set off. */ + rc = runImmedTriggers(psm, RPMSENSE_TRIGGERUN); + if (rc) break; +@@ -757,22 +760,26 @@ static rpmRC rpmPackageErase(rpmts ts, rpmpsm psm) + if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPREUN)) + rc = runInstScript(psm, RPMTAG_PREUN); + +- /* Run file triggers in this package other package(s) set off. */ +- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, +- RPMSCRIPT_FILETRIGGER, 2); +- if (rc) break; ++ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) { ++ /* Run file triggers in this package other package(s) set off. */ ++ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, ++ RPMSCRIPT_FILETRIGGER, 2); ++ if (rc) break; + +- /* Run file triggers in other package(s) this package sets off. */ +- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, +- RPMSCRIPT_FILETRIGGER, 2); +- if (rc) break; ++ /* Run file triggers in other package(s) this package sets off. */ ++ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN, ++ RPMSCRIPT_FILETRIGGER, 2); ++ if (rc) break; ++ } + + rc = rpmpsmRemove(psm); + if (rc) break; + + /* Run file triggers in other package(s) this package sets off. */ +- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN, +- RPMSCRIPT_FILETRIGGER, 1); ++ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERPOSTUN)) { ++ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN, ++ RPMSCRIPT_FILETRIGGER, 1); ++ } + + if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOSTUN)) { + rc = runInstScript(psm, RPMTAG_POSTUN); +@@ -783,15 +790,17 @@ static rpmRC rpmPackageErase(rpmts ts, rpmpsm psm) + /* Run triggers in other package(s) this package sets off. */ + rc = runTriggers(psm, RPMSENSE_TRIGGERPOSTUN); + if (rc) break; +- } + +- /* Run file triggers in other package(s) this package sets off. */ +- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN, +- RPMSCRIPT_FILETRIGGER, 2); ++ /* Run file triggers in other package(s) this package sets off. */ ++ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN, ++ RPMSCRIPT_FILETRIGGER, 2); ++ } + if (rc) break; + +- /* Prepare post transaction uninstall triggers */ +- rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te); ++ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) { ++ /* Prepare post transaction uninstall triggers */ ++ rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te); ++ } + + rc = dbRemove(ts, psm->te); + } +diff --git a/lib/transaction.c b/lib/transaction.c +index 8f440b7..66888af 100644 +--- a/lib/transaction.c ++++ b/lib/transaction.c +@@ -1488,7 +1488,9 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) + goto exit; + } + +- if (!rpmpsNumProblems(tsprobs)) { ++ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_NOPRETRANS| ++ RPMTRANS_FLAG_NOTRIGGERUN) || rpmpsNumProblems(tsprobs))) { ++ + /* Run file triggers in this package other package(s) set off. */ + runFileTriggers(ts, NULL, RPMSENSE_TRIGGERUN, + RPMSCRIPT_TRANSFILETRIGGER, 0); +@@ -1541,11 +1543,17 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) + } + + /* Run file triggers in other package(s) this package sets off. */ +- runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0); +- runPostUnTransFileTrigs(ts); ++ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) { ++ runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0); ++ } ++ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) { ++ runPostUnTransFileTrigs(ts); ++ } + + /* Run file triggers in this package other package(s) set off. */ +- runTransScripts(ts, PKG_TRANSFILETRIGGERIN); ++ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) { ++ runTransScripts(ts, PKG_TRANSFILETRIGGERIN); ++ } + exit: + /* Run post transaction hook for all plugins */ + if (TsmPreDone) /* If TsmPre hook has been called, call the TsmPost hook */ +-- +1.9.3 + diff --git a/rpm.spec b/rpm.spec index d0a1d1b..5553c12 100644 --- a/rpm.spec +++ b/rpm.spec @@ -29,7 +29,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}12%{?dist} +Release: %{?snapver:0.%{snapver}.}13%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2 @@ -62,6 +62,7 @@ Patch106: rpm-4.13.0-autopatch-fix.patch Patch107: rpm-4.13.0-ignore-sigpipe.patch Patch108: rpm-4.13.0-unsupported-keys.patch Patch109: rpm-4.13.0-fix-crash-on-corrupted.patch +Patch110: rpm-4.13.0-disabling-filetriggers.patch # These are not yet upstream Patch302: rpm-4.7.1-geode-i686.patch @@ -566,6 +567,10 @@ exit 0 %doc doc/librpm/html/* %changelog +* Mon Nov 23 2015 Lubos Kardos - 4.13.0-0.rc1.13 +- Add possibility to disable file triggers +- Fix unwanted multiple execution of filetriggers in dnf (#1282115) + * Thu Nov 12 2015 Fedora Release Engineering - 4.13.0-0.rc1.12 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5