On Monday, 6 March 2017 11:43:14 CET Richard W.M. Jones wrote:
Instead of just documenting this bug, fix it in the file_contexts
file.
Replaces commit ad3c8fe7f49c4991e1aa536856a1a408f55d5409.
---
customize/SELinux_relabel.ml | 19 +++++++++++++++++++
v2v/virt-v2v.pod | 11 -----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/customize/SELinux_relabel.ml b/customize/SELinux_relabel.ml
index fa9603c..69a4779 100644
--- a/customize/SELinux_relabel.ml
+++ b/customize/SELinux_relabel.ml
@@ -44,6 +44,25 @@ let relabel (g : G.guestfs) =
let specfile =
sprintf "/etc/selinux/%s/contexts/files/file_contexts" policy in
+ (* RHEL 6.2 - 6.5 had a malformed specfile that contained the
+ * invalid regular expression "/var/run/spice-vdagentd.\pid"
+ * (instead of "\.p"). This stops setfiles from working on
+ * the guest.
+ *
+ * Because an SELinux relabel writes all over the filesystem,
+ * it seems reasonable to fix this problem in the specfile
+ * at the same time. (RHBZ#1374232)
+ *)
+ if g#grep ~fixed:true ".\\p" specfile <> [||] then (
Should the search&replace be restricted to e.g. "spice-vdagentd.\pid",
to avoid possible breaks with other versions of the contexts file?
Thanks,
--
Pino Toscano