[PATCH] virQEMUCapsLoadCache: Parse <selfvers/> properly

Michal Privoznik posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/0b9fae8f797eb0b8f791f48c274892b28272487c.1672765125.git.mprivozn@redhat.com
src/qemu/qemu_capabilities.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] virQEMUCapsLoadCache: Parse <selfvers/> properly
Posted by Michal Privoznik 1 year, 4 months ago
In a recent commit, when ditching virXPathULong() the parsing of
<selfvers/> was changed. But it was changed to virXMLPropUInt()
which is not correct because the value we're interested in is not
in an attribute but element itself.

Fixes: a3c7426839df25f4026707c5877be75f2461f5e9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_capabilities.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e6024a2d75..0c16366f21 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4533,8 +4533,8 @@ virQEMUCapsLoadCache(virArch hostArch,
     }
     qemuCaps->libvirtCtime = (time_t)l;
 
-    if (virXMLPropUInt(ctxt->node, "selfvers", 10, VIR_XML_PROP_NONE,
-                       &qemuCaps->libvirtVersion) < 0)
+    if (virXPathUInt("string(./selfvers)", ctxt,
+                     &qemuCaps->libvirtVersion) < 0)
         return -1;
 
     if (!skipInvalidation &&
-- 
2.38.2
Re: [PATCH] virQEMUCapsLoadCache: Parse <selfvers/> properly
Posted by Jiri Denemark 1 year, 3 months ago
On Tue, Jan 03, 2023 at 17:58:45 +0100, Michal Privoznik wrote:
> In a recent commit, when ditching virXPathULong() the parsing of
> <selfvers/> was changed. But it was changed to virXMLPropUInt()
> which is not correct because the value we're interested in is not
> in an attribute but element itself.
> 
> Fixes: a3c7426839df25f4026707c5877be75f2461f5e9
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index e6024a2d75..0c16366f21 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4533,8 +4533,8 @@ virQEMUCapsLoadCache(virArch hostArch,
>      }
>      qemuCaps->libvirtCtime = (time_t)l;
>  
> -    if (virXMLPropUInt(ctxt->node, "selfvers", 10, VIR_XML_PROP_NONE,
> -                       &qemuCaps->libvirtVersion) < 0)
> +    if (virXPathUInt("string(./selfvers)", ctxt,
> +                     &qemuCaps->libvirtVersion) < 0)
>          return -1;
>  
>      if (!skipInvalidation &&

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>