|
Lubos Kardos |
ece6f4 |
From 9aff39d0d530332e8cae376f2390b6546239a20e Mon Sep 17 00:00:00 2001
|
|
Lubos Kardos |
ece6f4 |
From: Lubos Kardos <lkardos@redhat.com>
|
|
Lubos Kardos |
ece6f4 |
Date: Thu, 14 Jan 2016 13:35:28 +0100
|
|
Lubos Kardos |
ece6f4 |
Subject: [PATCH] Fix not chrooting transaction file triggers
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
previously those filetriggers would call tools out of the chroot, which
|
|
Lubos Kardos |
ece6f4 |
breaks installers such as DrakX or Anaconda.
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
See https://bugs.mageia.org/show_bug.cgi?id=17217
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
Thanks Thierry Vignaud for finding and helping to solve this.
|
|
Lubos Kardos |
ece6f4 |
---
|
|
Lubos Kardos |
ece6f4 |
lib/rpmtriggers.c | 14 ++++++++++++++
|
|
Lubos Kardos |
ece6f4 |
1 file changed, 14 insertions(+)
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
diff --git a/lib/rpmtriggers.c b/lib/rpmtriggers.c
|
|
Lubos Kardos |
ece6f4 |
index 211e62f..4c6e821 100644
|
|
Lubos Kardos |
ece6f4 |
--- a/lib/rpmtriggers.c
|
|
Lubos Kardos |
ece6f4 |
+++ b/lib/rpmtriggers.c
|
|
Lubos Kardos |
ece6f4 |
@@ -11,6 +11,7 @@
|
|
Lubos Kardos |
ece6f4 |
#include "lib/rpmdb_internal.h"
|
|
Lubos Kardos |
ece6f4 |
#include "lib/rpmds_internal.h"
|
|
Lubos Kardos |
ece6f4 |
#include "lib/rpmfi_internal.h"
|
|
Lubos Kardos |
ece6f4 |
+#include "lib/rpmchroot.h"
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
#define TRIGGER_PRIORITY_BOUND 10000
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
@@ -157,6 +158,9 @@ int runPostUnTransFileTrigs(rpmts ts)
|
|
Lubos Kardos |
ece6f4 |
rpmtriggers trigs = ts->trigs2run;
|
|
Lubos Kardos |
ece6f4 |
int nerrors = 0;
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
+ if (rpmChrootIn() != 0)
|
|
Lubos Kardos |
ece6f4 |
+ return -1;
|
|
Lubos Kardos |
ece6f4 |
+
|
|
Lubos Kardos |
ece6f4 |
rpmtriggersSortAndUniq(trigs);
|
|
Lubos Kardos |
ece6f4 |
/* Iterate over stored triggers */
|
|
Lubos Kardos |
ece6f4 |
for (i = 0; i < trigs->count; i++) {
|
|
Lubos Kardos |
ece6f4 |
@@ -180,6 +184,9 @@ int runPostUnTransFileTrigs(rpmts ts)
|
|
Lubos Kardos |
ece6f4 |
rpmScriptFree(script);
|
|
Lubos Kardos |
ece6f4 |
headerFree(trigH);
|
|
Lubos Kardos |
ece6f4 |
}
|
|
Lubos Kardos |
ece6f4 |
+
|
|
Lubos Kardos |
ece6f4 |
+ rpmChrootOut();
|
|
Lubos Kardos |
ece6f4 |
+
|
|
Lubos Kardos |
ece6f4 |
return nerrors;
|
|
Lubos Kardos |
ece6f4 |
}
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
@@ -530,6 +537,11 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
|
|
Lubos Kardos |
ece6f4 |
/* Sort triggers by priority, offset, trigger index */
|
|
Lubos Kardos |
ece6f4 |
rpmtriggersSortAndUniq(triggers);
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
+ if (rpmChrootIn() != 0) {
|
|
Lubos Kardos |
ece6f4 |
+ rpmtriggersFree(triggers);
|
|
Lubos Kardos |
ece6f4 |
+ return RPMRC_FAIL;
|
|
Lubos Kardos |
ece6f4 |
+ }
|
|
Lubos Kardos |
ece6f4 |
+
|
|
Lubos Kardos |
ece6f4 |
/* Handle stored triggers */
|
|
Lubos Kardos |
ece6f4 |
for (i = 0; i < triggers->count; i++) {
|
|
Lubos Kardos |
ece6f4 |
if (priorityClass == 1) {
|
|
Lubos Kardos |
ece6f4 |
@@ -550,6 +562,8 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
|
|
Lubos Kardos |
ece6f4 |
headerFree(trigH);
|
|
Lubos Kardos |
ece6f4 |
}
|
|
Lubos Kardos |
ece6f4 |
rpmtriggersFree(triggers);
|
|
Lubos Kardos |
ece6f4 |
+ /* XXX an error here would require a full abort */
|
|
Lubos Kardos |
ece6f4 |
+ (void) rpmChrootOut();
|
|
Lubos Kardos |
ece6f4 |
|
|
Lubos Kardos |
ece6f4 |
return (nerrors == 0) ? RPMRC_OK : RPMRC_FAIL;
|
|
Lubos Kardos |
ece6f4 |
}
|
|
Lubos Kardos |
ece6f4 |
--
|
|
Lubos Kardos |
ece6f4 |
1.9.3
|
|
Lubos Kardos |
ece6f4 |
|