From 117cba40b02c53fb624493e8e95e855ebee7f1e1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 6 Aug 2021 09:51:43 +0100 Subject: [PATCH] Fix: syslinux: failed to create ldlinux.sys resolves: rhbz#1990720, rhbz#1950627 Fix license files. (cherry picked from commit 4c961db464b5b1e1a79de60b593a34270d768394) Move appliance to separate subpackage resolves: rhbz#1989514 https://bugzilla.redhat.com/show_bug.cgi?id=1989514 Move the appliance to a subpackage (libguestfs-appliance). The main package depends on this new subpackage so in effect nothing changes for most users. However this allows the appliance to be replaced if there exists a package called "libguestfs-noappliance". This package is not provided anywhere, you have to provide the dependency or make the package yourself. But if you do this then libguestfs won't install the appliance and you are free to replace it with (eg) a fixed appliance. (cherry picked from commit 941da6407875ca8e054c2e1605ce0d379f4f313d) --- 0001-build-Don-t-use-non-POSIX-tests.patch | 38 ++++++++ ...k-fields-when-creating-Python-struct.patch | 86 +++++++++++++++++++ ...-IBM850-iconv-converter-for-syslinux.patch | 34 ++++++++ ...L-Remove-libguestfs-live-RHBZ-798980.patch | 4 +- ...Remove-9p-APIs-from-RHEL-RHBZ-921710.patch | 4 +- ...upported-remote-drive-protocols-RHBZ.patch | 4 +- ...-Remove-User-Mode-Linux-RHBZ-1144197.patch | 4 +- ...of-libguestfs-winsupport-features-ex.patch | 6 +- ...crypto-policies-back-ends-opensslcnf.patch | 5 +- libguestfs.spec | 57 +++++++++--- 10 files changed, 216 insertions(+), 26 deletions(-) create mode 100644 0001-build-Don-t-use-non-POSIX-tests.patch create mode 100644 0002-python-Don-t-leak-fields-when-creating-Python-struct.patch create mode 100644 0003-appliance-Add-IBM850-iconv-converter-for-syslinux.patch rename 0001-RHEL-Remove-libguestfs-live-RHBZ-798980.patch => 0004-RHEL-Remove-libguestfs-live-RHBZ-798980.patch (90%) rename 0002-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch => 0005-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch (98%) rename 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch => 0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch (99%) rename 0004-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch => 0007-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch (93%) rename 0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch => 0008-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch (92%) rename 0006-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch => 0009-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch (86%) diff --git a/0001-build-Don-t-use-non-POSIX-tests.patch b/0001-build-Don-t-use-non-POSIX-tests.patch new file mode 100644 index 0000000..055f21c --- /dev/null +++ b/0001-build-Don-t-use-non-POSIX-tests.patch @@ -0,0 +1,38 @@ +From e68a844eb406f0b32cc2c4e60ca66bc1a7f94bdc Mon Sep 17 00:00:00 2001 +From: Martin Kletzander +Date: Mon, 31 May 2021 21:16:29 +0200 +Subject: [PATCH] build: Don't use non-POSIX tests + +The `test` builtin/binary usually accepts `==` for string comparison, it is +mostly accepted for typos and people being used to double equals, but is not +documented and not always accepted either. Since autoconf uses the default +shell, it might just fail in some cases with: + + ./configure: 29986: test: xrustc: unexpected operator + ./configure: 29990: test: xcargo: unexpected operator + +Just change it to single equals as it is done everywhere else. + +Signed-off-by: Martin Kletzander +--- + m4/guestfs-rust.m4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/m4/guestfs-rust.m4 b/m4/guestfs-rust.m4 +index aa12a9ef5..1dffd8118 100644 +--- a/m4/guestfs-rust.m4 ++++ b/m4/guestfs-rust.m4 +@@ -24,8 +24,8 @@ AS_IF([test "x$enable_rust" != "xno"],[ + AC_CHECK_PROG([RUSTC],[rustc],[rustc],[no]) + AC_CHECK_PROG([CARGO],[cargo],[cargo],[no]) + +- AS_IF([test "x$RUSTC" == "xno"], [AC_MSG_WARN([rustc not found])]) +- AS_IF([test "x$CARGO" == "xno"], [AC_MSG_WARN([cargo not found])]) ++ AS_IF([test "x$RUSTC" = "xno"], [AC_MSG_WARN([rustc not found])]) ++ AS_IF([test "x$CARGO" = "xno"], [AC_MSG_WARN([cargo not found])]) + ],[ + RUSTC=no + CARGO=no +-- +2.31.1 + diff --git a/0002-python-Don-t-leak-fields-when-creating-Python-struct.patch b/0002-python-Don-t-leak-fields-when-creating-Python-struct.patch new file mode 100644 index 0000000..09c9f43 --- /dev/null +++ b/0002-python-Don-t-leak-fields-when-creating-Python-struct.patch @@ -0,0 +1,86 @@ +From e84c63a2ca4bf2366af96eb1a1222cf494e228c9 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 27 Jul 2021 08:55:27 +0100 +Subject: [PATCH] python: Don't leak fields when creating Python structs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When creating and returning a Python struct we were adding fields from +the C struct, but did not reduce the ref count on the temporary value +after it had been moved to the struct, resulting in a memory leak. + +Reported-by: 朱丹 +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1985912 +--- + generator/python.ml | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/generator/python.ml b/generator/python.ml +index b3d3a5579..1afd05dd6 100644 +--- a/generator/python.ml ++++ b/generator/python.ml +@@ -173,44 +173,52 @@ and generate_python_structs () = + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, FBuffer -> + pr " value = PyBytes_FromStringAndSize (%s->%s, %s->%s_len);\n" + typ name typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, FUUID -> + pr " value = guestfs_int_py_fromstringsize (%s->%s, 32);\n" + typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, (FBytes|FUInt64) -> + pr " value = PyLong_FromUnsignedLongLong (%s->%s);\n" typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, FInt64 -> + pr " value = PyLong_FromLongLong (%s->%s);\n" typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, FUInt32 -> + pr " value = PyLong_FromUnsignedLong (%s->%s);\n" typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, FInt32 -> + pr " value = PyLong_FromLong (%s->%s);\n" typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + | name, FOptPercent -> + pr " if (%s->%s >= 0) {\n" typ name; + pr " value = PyFloat_FromDouble ((double) %s->%s);\n" typ name; + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n"; + pr " }\n"; + pr " else {\n"; + pr " Py_INCREF (Py_None);\n"; +@@ -222,6 +230,7 @@ and generate_python_structs () = + pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ++ pr " Py_DECREF (value);\n" + ) cols; + pr " return dict;\n"; + pr " err:\n"; +-- +2.31.1 + diff --git a/0003-appliance-Add-IBM850-iconv-converter-for-syslinux.patch b/0003-appliance-Add-IBM850-iconv-converter-for-syslinux.patch new file mode 100644 index 0000000..bb2f9d2 --- /dev/null +++ b/0003-appliance-Add-IBM850-iconv-converter-for-syslinux.patch @@ -0,0 +1,34 @@ +From 90a076fe19ead3c517ba2b45edfcc7fffec9860d Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 6 Aug 2021 08:26:51 +0100 +Subject: [PATCH] appliance: Add IBM850 iconv converter for syslinux + +$ guestfish -N fs:vfat:2G syslinux /dev/sda1 +libguestfs: error: syslinux: Error converting to codepage 850 Invalid argument +... + +This happens because of the default codepage requested by syslinux +(code page 850) combined with the appliance missing the iconv +converter for this codepage. + +Reported-by: Yongkui Guo +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1990720 +--- + appliance/packagelist.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/appliance/packagelist.in b/appliance/packagelist.in +index cede0ac0b..b5f9d9dc7 100644 +--- a/appliance/packagelist.in ++++ b/appliance/packagelist.in +@@ -28,6 +28,7 @@ ifelse(REDHAT,1, + dhclient + gfs-utils + gfs2-utils ++ glibc-gconv-extra dnl syslinux requires IBM850 iconv converter + grub + hfsplus-tools + iproute +-- +2.31.1 + diff --git a/0001-RHEL-Remove-libguestfs-live-RHBZ-798980.patch b/0004-RHEL-Remove-libguestfs-live-RHBZ-798980.patch similarity index 90% rename from 0001-RHEL-Remove-libguestfs-live-RHBZ-798980.patch rename to 0004-RHEL-Remove-libguestfs-live-RHBZ-798980.patch index ef3bcac..e46f5dc 100644 --- a/0001-RHEL-Remove-libguestfs-live-RHBZ-798980.patch +++ b/0004-RHEL-Remove-libguestfs-live-RHBZ-798980.patch @@ -1,7 +1,7 @@ -From fb09175a21b9ee333e3ad01ab9c8652263200ca4 Mon Sep 17 00:00:00 2001 +From 69751394dccdf5ade209b42aa97b498b59f42010 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 21 Dec 2012 15:50:11 +0000 -Subject: [PATCH 1/6] RHEL: Remove libguestfs live (RHBZ#798980). +Subject: [PATCH] RHEL: Remove libguestfs live (RHBZ#798980). This isn't supported in RHEL. diff --git a/0002-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/0005-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch similarity index 98% rename from 0002-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch rename to 0005-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch index 6496e82..feebb1f 100644 --- a/0002-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch +++ b/0005-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch @@ -1,7 +1,7 @@ -From e0af86a09b80b5fa0c5f308ae6f34d8315c1dc4d Mon Sep 17 00:00:00 2001 +From 3b7d5e86beb84d0a0fefe34d442dc3becdbf1fd5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 18 Jul 2013 18:31:53 +0100 -Subject: [PATCH 2/6] RHEL: Remove 9p APIs from RHEL (RHBZ#921710). +Subject: [PATCH] RHEL: Remove 9p APIs from RHEL (RHBZ#921710). --- daemon/9p.c | 182 -------------------------------------- diff --git a/0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch b/0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch similarity index 99% rename from 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch rename to 0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch index 841ec13..27ff625 100644 --- a/0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch +++ b/0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch @@ -1,7 +1,7 @@ -From fddb44d1a2c77739c9441d2cc0acfef9e62718a6 Mon Sep 17 00:00:00 2001 +From 3ee38c13db6bf6bcea375f66a38fb848d0251d83 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 29 Jul 2013 14:47:56 +0100 -Subject: [PATCH 3/6] RHEL: Disable unsupported remote drive protocols +Subject: [PATCH] RHEL: Disable unsupported remote drive protocols (RHBZ#962113). This disables support for unsupported remote drive protocols: diff --git a/0004-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch b/0007-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch similarity index 93% rename from 0004-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch rename to 0007-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch index edf5f00..63ba111 100644 --- a/0004-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch +++ b/0007-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch @@ -1,7 +1,7 @@ -From 155063a0c8290eb9c32c552c439cb8023d4a6390 Mon Sep 17 00:00:00 2001 +From a651907e06fb488ef91fdf8b624cf1d527cfb057 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 19 Sep 2014 13:38:20 +0100 -Subject: [PATCH 4/6] RHEL: Remove User-Mode Linux (RHBZ#1144197). +Subject: [PATCH] RHEL: Remove User-Mode Linux (RHBZ#1144197). This isn't supported in RHEL. --- diff --git a/0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch b/0008-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch similarity index 92% rename from 0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch rename to 0008-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch index 7edf33e..608fe4a 100644 --- a/0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +++ b/0008-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch @@ -1,8 +1,8 @@ -From b33e943827b2decc2a01f198f1b300a3c3f6710e Mon Sep 17 00:00:00 2001 +From 0315e1f00e229c990226203a3e04af1820f688c2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 7 Jul 2015 09:28:03 -0400 -Subject: [PATCH 5/6] RHEL: Reject use of libguestfs-winsupport features except - for virt-* tools (RHBZ#1240276). +Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for + virt-* tools (RHBZ#1240276). Fix the tests: it doesn't let us use guestfish for arbitrary Windows edits. diff --git a/0006-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch b/0009-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch similarity index 86% rename from 0006-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch rename to 0009-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch index ce915e9..029fdf3 100644 --- a/0006-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch +++ b/0009-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch @@ -1,8 +1,7 @@ -From 18c910479cb6465bcd3954c5d07f3ab6df5c944a Mon Sep 17 00:00:00 2001 +From 75d88b5fd89655b8c3ac2a385a5ac2f8dea560e5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 Jun 2021 15:29:11 +0100 -Subject: [PATCH 6/6] RHEL: Create - /etc/crypto-policies/back-ends/opensslcnf.config +Subject: [PATCH] RHEL: Create /etc/crypto-policies/back-ends/opensslcnf.config https://bugzilla.redhat.com/show_bug.cgi?id=1977214#c13 --- diff --git a/libguestfs.spec b/libguestfs.spec index 18f06b4..ef66207 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -57,7 +57,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.45.6 -Release: 10%{?dist} +Release: 11%{?dist} License: LGPLv2+ # Build only for architectures that have a kernel @@ -91,14 +91,22 @@ Source7: libguestfs.keyring # Maintainer script which helps with handling patches. Source8: copy-patches.sh +# Patches are maintained in the following repository: +# https://github.com/libguestfs/libguestfs/commits/rhel-9.0.0 + +# Patches. +Patch0001: 0001-build-Don-t-use-non-POSIX-tests.patch +Patch0002: 0002-python-Don-t-leak-fields-when-creating-Python-struct.patch +Patch0003: 0003-appliance-Add-IBM850-iconv-converter-for-syslinux.patch + # Downstream (RHEL-only) patches. %if 0%{?rhel} -Patch9001: 0001-RHEL-Remove-libguestfs-live-RHBZ-798980.patch -Patch9002: 0002-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch -Patch9003: 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch -Patch9004: 0004-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch -Patch9005: 0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch -Patch9006: 0006-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch +Patch0004: 0004-RHEL-Remove-libguestfs-live-RHBZ-798980.patch +Patch0005: 0005-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch +Patch0006: 0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch +Patch0007: 0007-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch +Patch0008: 0008-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +Patch0009: 0009-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch %endif %if 0%{patches_touch_autotools} @@ -309,8 +317,13 @@ BuildRequires: zfs-fuse %endif %endif -# For building the appliance. -Requires: supermin >= 5.1.18 +# Main package requires the appliance. This allows the appliance to +# be replaced if there exists a package called +# "libguestfs-noappliance". This package is not provided anywhere, +# you have to provide the dependency or make the package yourself. If +# you do then libguestfs won't install the appliance and you are free +# to replace it with (eg) a fixed appliance. +Requires: (%{name}-appliance = %{epoch}:%{version}-%{release} or %{name}-noappliance) # The daemon dependencies are not included automatically, because it # is buried inside the appliance, so list them here. @@ -417,6 +430,15 @@ Language bindings: %endif +%package appliance +Summary: Appliance for %{name} +Requires: supermin >= 5.1.18 + + +%description appliance +%{name}-appliance provides the appliance used by libguestfs. + + %package devel Summary: Development tools and libraries for %{name} Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} @@ -907,7 +929,8 @@ rm ocaml/html/.gitignore %files -f %{name}.lang -%doc COPYING README +%license COPYING COPYING.LIB +%doc README %{_bindir}/guestfish %{_bindir}/guestmount %{_bindir}/guestunmount @@ -916,8 +939,6 @@ rm ocaml/html/.gitignore %{_bindir}/virt-copy-out %{_bindir}/virt-tar-in %{_bindir}/virt-tar-out -%{_libdir}/guestfs/ -%exclude %{_libdir}/guestfs/supermin.d/zz-packages-* %{_libdir}/libguestfs.so.* %{_mandir}/man1/guestfish.1* %{_mandir}/man1/guestfs-faq.1* @@ -938,6 +959,11 @@ rm ocaml/html/.gitignore %config(noreplace) %{_sysconfdir}/libguestfs-tools.conf +%files appliance +%{_libdir}/guestfs/ +%exclude %{_libdir}/guestfs/supermin.d/zz-packages-* + + %files devel %doc AUTHORS BUGS HACKING TODO README %doc examples/*.c @@ -1120,6 +1146,13 @@ rm ocaml/html/.gitignore %changelog +* Fri Aug 06 2021 Richard W.M. Jones - 1:1.45.6-11 +- Fix: syslinux: failed to create ldlinux.sys + resolves: rhbz#1990720, rhbz#1950627 +- Fix license files. +- Move appliance to separate subpackage + resolves: rhbz#1989514 + * Mon Jul 26 2021 Jeff Law - 1:1.45.6-10 - Re-enable LTO