virt-v2v/0016-i-libvirt-Trim-whitespace-around-name.patch
Richard W.M. Jones 88802688a4 in-place: Add new -O option to write inspector XML
resolves: RHEL-58032
2024-12-09 19:30:09 +00:00

31 lines
1.0 KiB
Diff

From 669acaf0f56ffdb85a1d72fb37ff2958600003cc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 15 Nov 2024 14:00:07 +0000
Subject: [PATCH] -i libvirt: Trim whitespace around name
In -i libvirt / -i libvirtxml we didn't trim whitespace
around the name, so:
<name> foo </name>
would set the input name to the literal string " foo ".
(cherry picked from commit 9cb76069040543ce25003ac8c620aff3724964fc)
---
input/parse_libvirt_xml.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input/parse_libvirt_xml.ml b/input/parse_libvirt_xml.ml
index 4d0fcdf3..8009a05a 100644
--- a/input/parse_libvirt_xml.ml
+++ b/input/parse_libvirt_xml.ml
@@ -78,7 +78,7 @@ let parse_libvirt_xml ?conn xml =
match xpath_string "/domain/name/text()" with
| None | Some "" ->
error (f_"in the libvirt XML metadata, <name> is missing or empty")
- | Some s -> s in
+ | Some s -> String.trim s in
let genid =
match xpath_string "/domain/genid/text()" with
| None | Some "" -> None