Fix: syslinux: failed to create ldlinux.sys

resolves: rhbz#1990720, rhbz#1950627

Fix license files.

(cherry picked from commit 4c961db464)

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 941da64078)
This commit is contained in:
Richard W.M. Jones 2021-08-06 09:51:43 +01:00
parent fbe9081a63
commit 117cba40b0
10 changed files with 216 additions and 26 deletions

View File

@ -0,0 +1,38 @@
From e68a844eb406f0b32cc2c4e60ca66bc1a7f94bdc Mon Sep 17 00:00:00 2001
From: Martin Kletzander <mkletzan@redhat.com>
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 <mkletzan@redhat.com>
---
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

View File

@ -0,0 +1,86 @@
From e84c63a2ca4bf2366af96eb1a1222cf494e228c9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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: 朱丹 <zhudan24@huawei.com>
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

View File

@ -0,0 +1,34 @@
From 90a076fe19ead3c517ba2b45edfcc7fffec9860d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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

View File

@ -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" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 21 Dec 2012 15:50:11 +0000 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. This isn't supported in RHEL.

View File

@ -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" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Jul 2013 18:31:53 +0100 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 -------------------------------------- daemon/9p.c | 182 --------------------------------------

View File

@ -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" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Jul 2013 14:47:56 +0100 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). (RHBZ#962113).
This disables support for unsupported remote drive protocols: This disables support for unsupported remote drive protocols:

View File

@ -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" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 19 Sep 2014 13:38:20 +0100 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. This isn't supported in RHEL.
--- ---

View File

@ -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" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400 Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH 5/6] RHEL: Reject use of libguestfs-winsupport features except Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
for virt-* tools (RHBZ#1240276). virt-* tools (RHBZ#1240276).
Fix the tests: it doesn't let us use guestfish for arbitrary Windows Fix the tests: it doesn't let us use guestfish for arbitrary Windows
edits. edits.

View File

@ -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" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Jun 2021 15:29:11 +0100 Date: Tue, 29 Jun 2021 15:29:11 +0100
Subject: [PATCH 6/6] RHEL: Create Subject: [PATCH] RHEL: Create /etc/crypto-policies/back-ends/opensslcnf.config
/etc/crypto-policies/back-ends/opensslcnf.config
https://bugzilla.redhat.com/show_bug.cgi?id=1977214#c13 https://bugzilla.redhat.com/show_bug.cgi?id=1977214#c13
--- ---

View File

@ -57,7 +57,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs Name: libguestfs
Epoch: 1 Epoch: 1
Version: 1.45.6 Version: 1.45.6
Release: 10%{?dist} Release: 11%{?dist}
License: LGPLv2+ License: LGPLv2+
# Build only for architectures that have a kernel # Build only for architectures that have a kernel
@ -91,14 +91,22 @@ Source7: libguestfs.keyring
# Maintainer script which helps with handling patches. # Maintainer script which helps with handling patches.
Source8: copy-patches.sh 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. # Downstream (RHEL-only) patches.
%if 0%{?rhel} %if 0%{?rhel}
Patch9001: 0001-RHEL-Remove-libguestfs-live-RHBZ-798980.patch Patch0004: 0004-RHEL-Remove-libguestfs-live-RHBZ-798980.patch
Patch9002: 0002-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch Patch0005: 0005-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
Patch9003: 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch Patch0006: 0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch9004: 0004-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch Patch0007: 0007-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch
Patch9005: 0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch Patch0008: 0008-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch9006: 0006-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch Patch0009: 0009-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch
%endif %endif
%if 0%{patches_touch_autotools} %if 0%{patches_touch_autotools}
@ -309,8 +317,13 @@ BuildRequires: zfs-fuse
%endif %endif
%endif %endif
# For building the appliance. # Main package requires the appliance. This allows the appliance to
Requires: supermin >= 5.1.18 # 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 # The daemon dependencies are not included automatically, because it
# is buried inside the appliance, so list them here. # is buried inside the appliance, so list them here.
@ -417,6 +430,15 @@ Language bindings:
%endif %endif
%package appliance
Summary: Appliance for %{name}
Requires: supermin >= 5.1.18
%description appliance
%{name}-appliance provides the appliance used by libguestfs.
%package devel %package devel
Summary: Development tools and libraries for %{name} Summary: Development tools and libraries for %{name}
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
@ -907,7 +929,8 @@ rm ocaml/html/.gitignore
%files -f %{name}.lang %files -f %{name}.lang
%doc COPYING README %license COPYING COPYING.LIB
%doc README
%{_bindir}/guestfish %{_bindir}/guestfish
%{_bindir}/guestmount %{_bindir}/guestmount
%{_bindir}/guestunmount %{_bindir}/guestunmount
@ -916,8 +939,6 @@ rm ocaml/html/.gitignore
%{_bindir}/virt-copy-out %{_bindir}/virt-copy-out
%{_bindir}/virt-tar-in %{_bindir}/virt-tar-in
%{_bindir}/virt-tar-out %{_bindir}/virt-tar-out
%{_libdir}/guestfs/
%exclude %{_libdir}/guestfs/supermin.d/zz-packages-*
%{_libdir}/libguestfs.so.* %{_libdir}/libguestfs.so.*
%{_mandir}/man1/guestfish.1* %{_mandir}/man1/guestfish.1*
%{_mandir}/man1/guestfs-faq.1* %{_mandir}/man1/guestfs-faq.1*
@ -938,6 +959,11 @@ rm ocaml/html/.gitignore
%config(noreplace) %{_sysconfdir}/libguestfs-tools.conf %config(noreplace) %{_sysconfdir}/libguestfs-tools.conf
%files appliance
%{_libdir}/guestfs/
%exclude %{_libdir}/guestfs/supermin.d/zz-packages-*
%files devel %files devel
%doc AUTHORS BUGS HACKING TODO README %doc AUTHORS BUGS HACKING TODO README
%doc examples/*.c %doc examples/*.c
@ -1120,6 +1146,13 @@ rm ocaml/html/.gitignore
%changelog %changelog
* Fri Aug 06 2021 Richard W.M. Jones <rjones@redhat.com> - 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 <jlaw@tachyum.com> - 1:1.45.6-10 * Mon Jul 26 2021 Jeff Law <jlaw@tachyum.com> - 1:1.45.6-10
- Re-enable LTO - Re-enable LTO