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

32 lines
1.1 KiB
Diff

From 837646d510e74d77ad80d4859aa03012682ce01b 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)
(cherry picked from commit 669acaf0f56ffdb85a1d72fb37ff2958600003cc)
---
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