From 3b9599d9b004d30f3d6b6581fd5eaa33dcec7f77 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 27 Nov 2023 14:17:56 +0000 Subject: [PATCH] Fix build issue with libxml2 2.12.1 --- ...-explicitly-disconnect-from-libvirtd.patch | 4 +- ...top-fix-to-parse-init-file-correctly.patch | 38 +++++++++++++++++++ 0003-src-Include-libxml-parser.h.patch | 33 ++++++++++++++++ virt-top.spec | 17 +++++++-- 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 0002-virt-top-fix-to-parse-init-file-correctly.patch create mode 100644 0003-src-Include-libxml-parser.h.patch diff --git a/0001-virt-top-fix-to-explicitly-disconnect-from-libvirtd.patch b/0001-virt-top-fix-to-explicitly-disconnect-from-libvirtd.patch index 330091f..fd607d3 100644 --- a/0001-virt-top-fix-to-explicitly-disconnect-from-libvirtd.patch +++ b/0001-virt-top-fix-to-explicitly-disconnect-from-libvirtd.patch @@ -1,7 +1,7 @@ From 4b15ee2440b0e70e3c1eb5e164ded493e2d8f0c8 Mon Sep 17 00:00:00 2001 From: Yuya Higashi Date: Tue, 15 Nov 2022 13:56:21 +0900 -Subject: [PATCH] virt-top: fix to explicitly disconnect from libvirtd +Subject: [PATCH 1/3] virt-top: fix to explicitly disconnect from libvirtd To prevent libvirtd from printing virNetSocketReadWire I/O errors when the virt-top command exits, explicitly disconnect from libvirtd. @@ -35,5 +35,5 @@ index 75fbcb9..cbe655a 100644 and get_key_press setup delay = (* Read the next key, waiting up to 'delay' milliseconds. *) -- -2.31.1 +2.42.0 diff --git a/0002-virt-top-fix-to-parse-init-file-correctly.patch b/0002-virt-top-fix-to-parse-init-file-correctly.patch new file mode 100644 index 0000000..8129f51 --- /dev/null +++ b/0002-virt-top-fix-to-parse-init-file-correctly.patch @@ -0,0 +1,38 @@ +From 1d04fdfce6edea685596fbb18920799c70f1d7fa Mon Sep 17 00:00:00 2001 +From: Yuya Higashi +Date: Mon, 26 Dec 2022 09:18:15 +0900 +Subject: [PATCH 2/3] virt-top: fix to parse init-file correctly + +This fixes the following runtime error when parsing init-file. + +$ virt-top --init-file <(echo "sort id") +Error: Invalid_argument("String.sub / Bytes.sub") +Raised at Stdlib.invalid_arg in file "stdlib.ml", line 30, characters 20-45 +Called from Stdlib__String.sub in file "string.ml" (inlined), line 50, characters 2-23 +Called from Utils.split in file "utils.ml", line 82, characters 24-68 +Called from Utils.read_config_file.(fun) in file "utils.ml", line 114, characters 23-37 +Called from Stdlib__List.map in file "list.ml", line 92, characters 20-23 +Called from Top.start_up.try_to_read_init_file in file "top.ml", line 153, characters 17-42 +Called from Main.script_mode in file "main.ml", line 37, characters 6-17 + +Signed-off-by: Yuya Higashi +--- + src/utils.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/utils.ml b/src/utils.ml +index 1f00803..8dfb255 100644 +--- a/src/utils.ml ++++ b/src/utils.ml +@@ -79,7 +79,7 @@ let trim ?(test = isspace) str = + let split str sep = + try + let i = String.index str sep in +- String.sub str 0 i, String.sub str (i+1) (String.length str - 1) ++ String.sub str 0 i, String.sub str (i+1) (String.length str - i - 1) + with + Not_found -> str, "" + +-- +2.42.0 + diff --git a/0003-src-Include-libxml-parser.h.patch b/0003-src-Include-libxml-parser.h.patch new file mode 100644 index 0000000..a7d1537 --- /dev/null +++ b/0003-src-Include-libxml-parser.h.patch @@ -0,0 +1,33 @@ +From dd205eeae9fb06ac113884e4c9e9f3a90eef7554 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 27 Nov 2023 14:09:04 +0000 +Subject: [PATCH 3/3] src: Include +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +libxml2 2.12.1 failed with this error: + +xml-c.c:92:9: warning: implicit declaration of function ‘xmlReadMemory’; did you mean ‘xmlInitMemory’? [-Wimplicit-function-declaration] + 92 | doc = xmlReadMemory (String_val (xmlv), caml_string_length (xmlv), + | ^~~~~~~~~~~~~ + | xmlInitMemory +--- + src/xml-c.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/xml-c.c b/src/xml-c.c +index 72042bf..6c546b9 100644 +--- a/src/xml-c.c ++++ b/src/xml-c.c +@@ -28,6 +28,7 @@ + #include + #include + ++#include + #include + #include + +-- +2.42.0 + diff --git a/virt-top.spec b/virt-top.spec index dc87f61..f188b5e 100644 --- a/virt-top.spec +++ b/virt-top.spec @@ -3,7 +3,7 @@ ExcludeArch: %{ix86} Name: virt-top Version: 1.1.1 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Utility like top(1) for displaying virtualization stats License: GPL-2.0-or-later @@ -30,8 +30,14 @@ Patch1: virt-top-1.0.9-processcsv-documentation.patch # Fix "Input/output error" in journal (RHBZ#2148798) Patch2: 0001-virt-top-fix-to-explicitly-disconnect-from-libvirtd.patch +# Fix problem parsing init-file. +Patch3: 0002-virt-top-fix-to-parse-init-file-correctly.patch + +# Fix libxml2 2.12.1 build problems. +Patch4: 0003-src-Include-libxml-parser.h.patch + # Fix linking problems on bytecode-only architectures -Patch3: virt-top-1.1.1-ocaml-bytecode.patch +Patch5: virt-top-1.1.1-ocaml-bytecode.patch BuildRequires: gcc BuildRequires: make @@ -73,8 +79,10 @@ different virtualization systems. %patch -P1 -p1 %endif %patch -P2 -p1 -%ifnarch %{ocaml_native_compiler} %patch -P3 -p1 +%patch -P4 -p1 +%ifnarch %{ocaml_native_compiler} +%patch -P5 -p1 %endif # "ocamlfind byte" has been removed as an alias @@ -128,6 +136,9 @@ install -m 0644 processcsv.py.1 $RPM_BUILD_ROOT%{_mandir}/man1/ %changelog +* Mon Nov 27 2023 Richard W.M. Jones - 1.1.1-15 +- Fix build issue with libxml2 2.12.1 + * Thu Oct 05 2023 Richard W.M. Jones - 1.1.1-14 - OCaml 5.1 rebuild for Fedora 40