[Libguestfs] [PATCH] v2v: Fix invalid regexp in file_contexts file (RHBZ#1374232).

Pino Toscano ptoscano at redhat.com
Mon Mar 6 14:48:06 UTC 2017


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170306/7f0e7c52/attachment.sig>


More information about the Libguestfs mailing list