import libguestfs-1.44.0-5.module+el8.6.0+14480+c0a3aa0f

This commit is contained in:
CentOS Sources 2022-05-10 03:07:31 -04:00 committed by Stepan Oksanichenko
parent e951e074b3
commit 55b111a4aa
117 changed files with 7179 additions and 9651 deletions

4
.gitignore vendored
View File

@ -1,4 +1,2 @@
SOURCES/RHEV-Application-Provisioning-Tool.exe_4.43-5
SOURCES/libguestfs-1.40.2.tar.gz
SOURCES/libguestfs-1.44.0.tar.gz
SOURCES/libguestfs.keyring
SOURCES/rhsrvany.exe

View File

@ -1,4 +1,2 @@
130adbc011dc0af736465b813c2b22a600c128c1 SOURCES/RHEV-Application-Provisioning-Tool.exe_4.43-5
45755f0f73b503790974484053ff482f32665b13 SOURCES/libguestfs-1.40.2.tar.gz
99d241dc4a5ba0dc6111954ed7a872e0b0bb6944 SOURCES/libguestfs-1.44.0.tar.gz
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring
2bd96e478fc004cd323b5bd754c856641877dac6 SOURCES/rhsrvany.exe

View File

@ -1,15 +1,18 @@
From a7fefab912d97962fb77f0f57799b7b70634376c Mon Sep 17 00:00:00 2001
From 5b6d2b05fe0c4035b9791a751e3133d26c7baa2d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 21 Dec 2012 15:50:11 +0000
Subject: [PATCH] RHEL 8: Remove libguestfs live (RHBZ#798980).
This isn't supported in RHEL 8.
Disable daemon tests that require the 'unix' backend.
---
lib/launch-unix.c | 7 +++++++
1 file changed, 7 insertions(+)
lib/launch-unix.c | 7 +++++++
tests/daemon/Makefile.am | 4 +---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/launch-unix.c b/lib/launch-unix.c
index 4794a7b13..993b83601 100644
index 0d344f9df..74dd1bb4a 100644
--- a/lib/launch-unix.c
+++ b/lib/launch-unix.c
@@ -37,6 +37,12 @@
@ -33,6 +36,21 @@ index 4794a7b13..993b83601 100644
}
static int
diff --git a/tests/daemon/Makefile.am b/tests/daemon/Makefile.am
index 921e6d1df..8b2887247 100644
--- a/tests/daemon/Makefile.am
+++ b/tests/daemon/Makefile.am
@@ -23,9 +23,7 @@ include $(top_srcdir)/subdir-rules.mk
check_DATA = captive-daemon.pm
-TESTS = \
- test-daemon-start.pl \
- test-btrfs.pl
+TESTS =
TESTS_ENVIRONMENT = $(top_builddir)/run --test
--
2.18.4
2.31.1

View File

@ -1,56 +0,0 @@
From a5e8afb4ed8576a1b3398add2ede49a1f90ad01a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 30 Jul 2020 13:57:45 +0100
Subject: [PATCH] daemon, lib: Replace deprecated security_context_t with char
*.
This gives deprecation warnings. It always was simply a char *, and
the recommendation upstream is to replace uses with char *:
https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9
(cherry picked from commit eb78e990ac5277a4282293f8787af871a1420b61)
---
daemon/selinux.c | 3 +--
lib/launch-libvirt.c | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/daemon/selinux.c b/daemon/selinux.c
index 1c1446d30..f4d839c19 100644
--- a/daemon/selinux.c
+++ b/daemon/selinux.c
@@ -63,8 +63,7 @@ char *
do_getcon (void)
{
#if defined(HAVE_GETCON)
- security_context_t context;
- char *r;
+ char *context, *r;
if (getcon (&context) == -1) {
reply_with_perror ("getcon");
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index bc5978cc4..4a47bbb29 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -288,8 +288,7 @@ create_cow_overlay_libvirt (guestfs_h *g, void *datav, struct drive *drv)
if (data->selinux_imagelabel) {
debug (g, "setting SELinux label on %s to %s",
overlay, data->selinux_imagelabel);
- if (setfilecon (overlay,
- (security_context_t) data->selinux_imagelabel) == -1)
+ if (setfilecon (overlay, data->selinux_imagelabel) == -1)
selinux_warning (g, __func__, "setfilecon", overlay);
}
#endif
@@ -840,7 +839,7 @@ is_custom_hv (guestfs_h *g)
static void
set_socket_create_context (guestfs_h *g)
{
- security_context_t scon; /* this is actually a 'char *' */
+ char *scon;
context_t con;
if (getcon (&scon) == -1) {
--
2.18.4

View File

@ -1,22 +1,22 @@
From 683153015b95a7b6d4979d48736c80e366986c72 Mon Sep 17 00:00:00 2001
From 91b2a6e50211c58ea31a36351ec63c358f708bf9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Jul 2013 18:31:53 +0100
Subject: [PATCH] RHEL 8: Remove 9p APIs from RHEL (RHBZ#921710).
---
Makefile.am | 2 +-
daemon/9p.c | 224 --------------------------------------
daemon/9p.c | 182 --------------------------------------
daemon/Makefile.am | 1 -
docs/C_SOURCE_FILES | 1 -
generator/actions_core.ml | 21 ----
generator/actions_core.ml | 21 -----
generator/proc_nr.ml | 2 -
gobject/Makefile.inc | 2 -
po/POTFILES | 2 -
8 files changed, 1 insertion(+), 254 deletions(-)
8 files changed, 1 insertion(+), 212 deletions(-)
delete mode 100644 daemon/9p.c
diff --git a/Makefile.am b/Makefile.am
index 0067d7b7b..e9351eadc 100644
index 3df1b6a7a..36e44dfd5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,7 +78,7 @@ SUBDIRS += tests/xfs
@ -30,10 +30,10 @@ index 0067d7b7b..e9351eadc 100644
SUBDIRS += tests/disk-labels
diff --git a/daemon/9p.c b/daemon/9p.c
deleted file mode 100644
index 55644249d..000000000
index 743a96abd..000000000
--- a/daemon/9p.c
+++ /dev/null
@@ -1,224 +0,0 @@
@@ -1,182 +0,0 @@
-/* libguestfs - the guestfsd daemon
- * Copyright (C) 2011 Red Hat Inc.
- *
@ -65,21 +65,32 @@ index 55644249d..000000000
-#include <dirent.h>
-#include <fcntl.h>
-
-#include "ignore-value.h"
-
-#include "daemon.h"
-#include "actions.h"
-
-#define BUS_PATH "/sys/bus/virtio/drivers/9pnet_virtio"
-
-static char *read_whole_file (const char *filename);
-static void
-modprobe_9pnet_virtio (void)
-{
- /* Required with Linux 5.6 and maybe earlier kernels. For unclear
- * reasons the module is not an automatic dependency of the 9p
- * module so doesn't get loaded automatically.
- */
- ignore_value (command (NULL, NULL, "modprobe", "9pnet_virtio", NULL));
-}
-
-/* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */
-char **
-do_list_9p (void)
-{
- CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (r);
-
- DIR *dir;
-
- modprobe_9pnet_virtio ();
-
- dir = opendir (BUS_PATH);
- if (!dir) {
- perror ("opendir: " BUS_PATH);
@ -118,7 +129,7 @@ index 55644249d..000000000
- * the mount tag length to be unlimited (or up to 65536 bytes).
- * See: linux/include/linux/virtio_9p.h
- */
- CLEANUP_FREE char *mount_tag = read_whole_file (mount_tag_path);
- CLEANUP_FREE char *mount_tag = read_whole_file (mount_tag_path, NULL);
- if (mount_tag == 0)
- continue;
-
@ -153,60 +164,6 @@ index 55644249d..000000000
- return take_stringsbuf (&r);
-}
-
-/* Read whole file into dynamically allocated array. If there is an
- * error, DON'T call reply_with_perror, just return NULL. Returns a
- * \0-terminated string.
- */
-static char *
-read_whole_file (const char *filename)
-{
- char *r = NULL;
- size_t alloc = 0, size = 0;
- int fd;
-
- fd = open (filename, O_RDONLY|O_CLOEXEC);
- if (fd == -1) {
- perror (filename);
- return NULL;
- }
-
- while (1) {
- alloc += 256;
- char *r2 = realloc (r, alloc);
- if (r2 == NULL) {
- perror ("realloc");
- free (r);
- close (fd);
- return NULL;
- }
- r = r2;
-
- /* The '- 1' in the size calculation ensures there is space below
- * to add \0 to the end of the input.
- */
- ssize_t n = read (fd, r + size, alloc - size - 1);
- if (n == -1) {
- fprintf (stderr, "read: %s: %m\n", filename);
- free (r);
- close (fd);
- return NULL;
- }
- if (n == 0)
- break;
- size += n;
- }
-
- if (close (fd) == -1) {
- fprintf (stderr, "close: %s: %m\n", filename);
- free (r);
- return NULL;
- }
-
- r[size] = '\0';
-
- return r;
-}
-
-/* Takes optional arguments, consult optargs_bitmask. */
-int
-do_mount_9p (const char *mount_tag, const char *mountpoint, const char *options)
@ -249,6 +206,7 @@ index 55644249d..000000000
- }
- }
-
- modprobe_9pnet_virtio ();
- r = command (NULL, &err,
- "mount", "-o", opts, "-t", "9p", mount_tag, mp, NULL);
- if (r == -1) {
@ -259,10 +217,10 @@ index 55644249d..000000000
- return 0;
-}
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 5d1c222db..a9b40be25 100644
index 038be592c..df9dcc4ee 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -76,7 +76,6 @@ guestfsd_SOURCES = \
@@ -82,7 +82,6 @@ guestfsd_SOURCES = \
../common/protocol/guestfs_protocol.h \
../common/utils/cleanups.h \
../common/utils/guestfs-utils.h \
@ -271,22 +229,22 @@ index 5d1c222db..a9b40be25 100644
actions.h \
available.c \
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index 7f1c60b30..f45e7124d 100644
index cd5bd2924..831b7e25a 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -71,7 +71,6 @@ common/windows/windows.h
@@ -63,7 +63,6 @@ common/windows/windows.c
common/windows/windows.h
customize/crypt-c.c
customize/dummy.c
customize/perl_edit-c.c
-daemon/9p.c
daemon/acl.c
daemon/actions.h
daemon/augeas.c
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index deda483a9..f466600df 100644
index 806565b19..37476c93e 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -6167,27 +6167,6 @@ This returns true iff the device exists and contains all zero bytes.
@@ -6157,27 +6157,6 @@ This returns true iff the device exists and contains all zero bytes.
Note that for large devices this can take a long time to run." };
@ -315,7 +273,7 @@ index deda483a9..f466600df 100644
name = "list_dm_devices"; added = (1, 11, 15);
style = RStringList (RDevice, "devices"), [], [];
diff --git a/generator/proc_nr.ml b/generator/proc_nr.ml
index 11a557076..1ef5ba0b7 100644
index 30e42864f..57976be36 100644
--- a/generator/proc_nr.ml
+++ b/generator/proc_nr.ml
@@ -295,8 +295,6 @@ let proc_nr = [
@ -328,10 +286,10 @@ index 11a557076..1ef5ba0b7 100644
288, "ntfsresize";
289, "btrfs_filesystem_resize";
diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
index 067f861a9..7afe83c59 100644
index 650f8ddac..c4e735967 100644
--- a/gobject/Makefile.inc
+++ b/gobject/Makefile.inc
@@ -93,7 +93,6 @@ guestfs_gobject_headers= \
@@ -94,7 +94,6 @@ guestfs_gobject_headers= \
include/guestfs-gobject/optargs-mksquashfs.h \
include/guestfs-gobject/optargs-mkswap.h \
include/guestfs-gobject/optargs-mktemp.h \
@ -339,7 +297,7 @@ index 067f861a9..7afe83c59 100644
include/guestfs-gobject/optargs-mount_local.h \
include/guestfs-gobject/optargs-ntfsclone_out.h \
include/guestfs-gobject/optargs-ntfsfix.h \
@@ -186,7 +185,6 @@ guestfs_gobject_sources= \
@@ -188,7 +187,6 @@ guestfs_gobject_sources= \
src/optargs-mksquashfs.c \
src/optargs-mkswap.c \
src/optargs-mktemp.c \
@ -348,18 +306,18 @@ index 067f861a9..7afe83c59 100644
src/optargs-ntfsclone_out.c \
src/optargs-ntfsfix.c \
diff --git a/po/POTFILES b/po/POTFILES
index 79f4b8c56..b99333d0d 100644
index 69ea7134a..0782e8ceb 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -58,7 +58,6 @@ customize/crypt-c.c
customize/dummy.c
@@ -47,7 +47,6 @@ common/visit/visit.c
common/windows/windows.c
customize/crypt-c.c
customize/perl_edit-c.c
customize/test-password.pl
-daemon/9p.c
daemon/acl.c
daemon/augeas.c
daemon/available.c
@@ -291,7 +290,6 @@ gobject/src/optargs-mkfs_btrfs.c
@@ -277,7 +276,6 @@ gobject/src/optargs-mkfs_btrfs.c
gobject/src/optargs-mksquashfs.c
gobject/src/optargs-mkswap.c
gobject/src/optargs-mktemp.c
@ -368,5 +326,5 @@ index 79f4b8c56..b99333d0d 100644
gobject/src/optargs-ntfsclone_out.c
gobject/src/optargs-ntfsfix.c
--
2.18.4
2.31.1

View File

@ -1,36 +0,0 @@
From 524b0c748a3a2d47b4c76e3aa546b9d4af144e6c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 7 Dec 2019 11:08:54 +0000
Subject: [PATCH] caml_named_value returns const value pointer in OCaml 4.09+
(cherry picked from ocaml-augeas
commit 1cf5aef99b26a46529ca797547c0b49627fffe78)
---
common/mlaugeas/augeas-c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/mlaugeas/augeas-c.c b/common/mlaugeas/augeas-c.c
index 3e0ba67ba..3b1dc2551 100644
--- a/common/mlaugeas/augeas-c.c
+++ b/common/mlaugeas/augeas-c.c
@@ -77,7 +77,7 @@ static const int error_map_len = sizeof error_map / sizeof error_map[0];
static void
raise_error (augeas_t t, const char *msg)
{
- value *exn = caml_named_value ("Augeas.Error");
+ const value *exn = caml_named_value ("Augeas.Error");
value args[4];
const int code = aug_error (t);
const char *aug_err_minor;
@@ -113,7 +113,7 @@ raise_error (augeas_t t, const char *msg)
static void
raise_init_error (const char *msg)
{
- value *exn = caml_named_value ("Augeas.Error");
+ const value *exn = caml_named_value ("Augeas.Error");
value args[4];
args[0] = caml_alloc (1, 0);
--
2.18.4

View File

@ -1,4 +1,4 @@
From 336961659225584add638442cc0cf933803e008e Mon Sep 17 00:00:00 2001
From 4dd2f3f56a39411a255ad0a8f38081d46620dbd8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Jul 2013 14:47:56 +0100
Subject: [PATCH] RHEL 8: Disable unsupported remote drive protocols
@ -62,7 +62,7 @@ index f558964bf..8f264ed17 100644
Run L<virt-alignment-scan(1)> on guests or disk images:
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index f1fdf094d..bacb60e0b 100644
index 9f086f110..bb4167b06 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -131,9 +131,9 @@ To list what is available do:
@ -77,7 +77,7 @@ index f1fdf094d..bacb60e0b 100644
=head2 Remote control
@@ -1145,12 +1145,12 @@ L<guestfs(3)/REMOTE STORAGE>>.
@@ -1134,12 +1134,12 @@ L<guestfs(3)/REMOTE STORAGE>>.
On the command line, you can use the I<-a> option to add network
block devices using a URI-style format, for example:
@ -92,7 +92,7 @@ index f1fdf094d..bacb60e0b 100644
The possible I<-a URI> formats are described below.
@@ -1160,40 +1160,6 @@ The possible I<-a URI> formats are described below.
@@ -1149,40 +1149,6 @@ The possible I<-a URI> formats are described below.
Add the local disk image (or device) called F<disk.img>.
@ -133,7 +133,7 @@ index f1fdf094d..bacb60e0b 100644
=head2 B<-a nbd://example.com[:port]>
=head2 B<-a nbd://example.com[:port]/exportname>
@@ -1228,35 +1194,13 @@ The equivalent API command would be:
@@ -1217,35 +1183,13 @@ The equivalent API command would be:
><fs> add pool/disk protocol:rbd server:tcp:example.com:port
@ -171,7 +171,7 @@ index f1fdf094d..bacb60e0b 100644
In this case, the password is C<pass@word>.
diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
index 756df997b..8f84fd31b 100755
index 21d424984..ddabeb639 100755
--- a/fish/test-add-uri.sh
+++ b/fish/test-add-uri.sh
@@ -40,14 +40,6 @@ function fail ()
@ -220,7 +220,7 @@ index 756df997b..8f84fd31b 100755
rm test-add-uri.out
rm test-add-uri.img
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index f466600df..3893d0e8d 100644
index 37476c93e..9f0402510 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -297,29 +297,6 @@ F<filename> is interpreted as a local file or device.
@ -305,10 +305,10 @@ index f466600df..3893d0e8d 100644
example if using the libvirt backend and if the libvirt backend is configured to
start the qemu appliance as a special user such as C<qemu.qemu>. If in doubt,
diff --git a/lib/drives.c b/lib/drives.c
index 82ef30093..3d712c6e4 100644
index 46af66db4..c81ded5d7 100644
--- a/lib/drives.c
+++ b/lib/drives.c
@@ -165,6 +165,7 @@ create_drive_non_file (guestfs_h *g,
@@ -168,6 +168,7 @@ create_drive_non_file (guestfs_h *g,
return drv;
}
@ -316,7 +316,7 @@ index 82ef30093..3d712c6e4 100644
static struct drive *
create_drive_curl (guestfs_h *g,
const struct drive_create_data *data)
@@ -223,6 +224,7 @@ create_drive_gluster (guestfs_h *g,
@@ -226,6 +227,7 @@ create_drive_gluster (guestfs_h *g,
return create_drive_non_file (g, data);
}
@ -324,7 +324,7 @@ index 82ef30093..3d712c6e4 100644
static int
nbd_port (void)
@@ -291,6 +293,7 @@ create_drive_rbd (guestfs_h *g,
@@ -294,6 +296,7 @@ create_drive_rbd (guestfs_h *g,
return create_drive_non_file (g, data);
}
@ -332,7 +332,7 @@ index 82ef30093..3d712c6e4 100644
static struct drive *
create_drive_sheepdog (guestfs_h *g,
const struct drive_create_data *data)
@@ -391,6 +394,7 @@ create_drive_iscsi (guestfs_h *g,
@@ -394,6 +397,7 @@ create_drive_iscsi (guestfs_h *g,
return create_drive_non_file (g, data);
}
@ -340,7 +340,7 @@ index 82ef30093..3d712c6e4 100644
/**
* Create the special F</dev/null> drive.
@@ -826,6 +830,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
@@ -856,6 +860,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
drv = create_drive_file (g, &data);
}
}
@ -348,7 +348,7 @@ index 82ef30093..3d712c6e4 100644
else if (STREQ (protocol, "ftp")) {
data.protocol = drive_protocol_ftp;
drv = create_drive_curl (g, &data);
@@ -850,6 +855,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
@@ -880,6 +885,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
data.protocol = drive_protocol_iscsi;
drv = create_drive_iscsi (g, &data);
}
@ -356,7 +356,7 @@ index 82ef30093..3d712c6e4 100644
else if (STREQ (protocol, "nbd")) {
data.protocol = drive_protocol_nbd;
drv = create_drive_nbd (g, &data);
@@ -858,6 +864,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
@@ -888,6 +894,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
data.protocol = drive_protocol_rbd;
drv = create_drive_rbd (g, &data);
}
@ -364,7 +364,7 @@ index 82ef30093..3d712c6e4 100644
else if (STREQ (protocol, "sheepdog")) {
data.protocol = drive_protocol_sheepdog;
drv = create_drive_sheepdog (g, &data);
@@ -870,6 +877,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
@@ -900,6 +907,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
data.protocol = drive_protocol_tftp;
drv = create_drive_curl (g, &data);
}
@ -373,10 +373,10 @@ index 82ef30093..3d712c6e4 100644
error (g, _("unknown protocol %s"), protocol);
drv = NULL; /*FALLTHROUGH*/
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index af944ddb7..58559a6b4 100644
index bce9eb79f..2bb13b875 100644
--- a/lib/guestfs.pod
+++ b/lib/guestfs.pod
@@ -714,70 +714,6 @@ servers. The server string is documented in
@@ -715,70 +715,6 @@ servers. The server string is documented in
L</guestfs_add_drive_opts>. The C<username> and C<secret> parameters are
also optional, and if not given, then no authentication will be used.
@ -447,7 +447,7 @@ index af944ddb7..58559a6b4 100644
=head3 NETWORK BLOCK DEVICE
Libguestfs can access Network Block Device (NBD) disks remotely.
@@ -840,42 +776,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677>
@@ -841,42 +777,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677>
=back
@ -491,7 +491,7 @@ index af944ddb7..58559a6b4 100644
Libguestfs has APIs for inspecting an unknown disk image to find out
diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
index e49c69b43..9b1abc4ec 100755
index 3c5aa592e..f73827bd6 100755
--- a/tests/disks/test-qemu-drive-libvirt.sh
+++ b/tests/disks/test-qemu-drive-libvirt.sh
@@ -64,34 +64,6 @@ check_output
@ -605,5 +605,5 @@ index 19dd60a2f..583e031bd 100755
-grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
-rm "$DEBUG_QEMU_FILE"
--
2.18.4
2.31.1

View File

@ -1,78 +0,0 @@
From 3860ab78d9fe5c34785aabc2227ebc8687b1171b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 5 Sep 2019 09:00:14 +0100
Subject: [PATCH] ocaml: Change calls to caml_named_value() to cope with const
value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is
declared const.
Based on Pino Toscano's original patch to ocaml-augeas.
(cherry picked from commit 9788fa50601ad4f1eab56d0b763591268026e536)
---
common/mlpcre/pcre-c.c | 3 +--
common/mltools/uri-c.c | 6 ++----
common/mlvisit/visit-c.c | 4 +---
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c
index 0762a8341..07f99b8d6 100644
--- a/common/mlpcre/pcre-c.c
+++ b/common/mlpcre/pcre-c.c
@@ -73,12 +73,11 @@ init (void)
static void
raise_pcre_error (const char *msg, int errcode)
{
- value *exn = caml_named_value ("PCRE.Error");
value args[2];
args[0] = caml_copy_string (msg);
args[1] = Val_int (errcode);
- caml_raise_with_args (*exn, 2, args);
+ caml_raise_with_args (*caml_named_value ("PCRE.Error"), 2, args);
}
/* Wrap and unwrap pcre regular expression handles, with a finalizer. */
diff --git a/common/mltools/uri-c.c b/common/mltools/uri-c.c
index 2a8837cd9..e03647c7b 100644
--- a/common/mltools/uri-c.c
+++ b/common/mltools/uri-c.c
@@ -46,10 +46,8 @@ guestfs_int_mllib_parse_uri (value argv /* arg value, not an array! */)
int r;
r = parse_uri (String_val (argv), &uri);
- if (r == -1) {
- value *exn = caml_named_value ("URI.Parse_failed");
- caml_raise (*exn);
- }
+ if (r == -1)
+ caml_raise (*caml_named_value ("URI.Parse_failed"));
/* Convert the struct into an OCaml tuple. */
rv = caml_alloc_tuple (5);
diff --git a/common/mlvisit/visit-c.c b/common/mlvisit/visit-c.c
index 7137c4998..201f6d762 100644
--- a/common/mlvisit/visit-c.c
+++ b/common/mlvisit/visit-c.c
@@ -53,7 +53,6 @@ value
guestfs_int_mllib_visit (value gv, value dirv, value fv)
{
CAMLparam3 (gv, dirv, fv);
- value *visit_failure_exn;
guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gv);
struct visitor_function_wrapper_args args;
/* The dir string could move around when we call the
@@ -84,8 +83,7 @@ guestfs_int_mllib_visit (value gv, value dirv, value fv)
* already printed the error to stderr (XXX - fix), so we raise a
* generic exception.
*/
- visit_failure_exn = caml_named_value ("Visit.Failure");
- caml_raise (*visit_failure_exn);
+ caml_raise (*caml_named_value ("Visit.Failure"));
}
free (dir);
--
2.18.4

View File

@ -1,4 +1,4 @@
From cbb6a42b9074ed78c74ddefee4ec7571132a4d24 Mon Sep 17 00:00:00 2001
From 34f8c6a5eb0eabfba4ab1831b45e2baa73a4b501 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 19 Sep 2014 13:38:20 +0100
Subject: [PATCH] RHEL 8: Remove User-Mode Linux (RHBZ#1144197).
@ -9,7 +9,7 @@ This isn't supported in RHEL 8.
1 file changed, 13 insertions(+)
diff --git a/lib/launch-uml.c b/lib/launch-uml.c
index da20c17d9..a5e0e8179 100644
index 5aec50a57..8b9fcd770 100644
--- a/lib/launch-uml.c
+++ b/lib/launch-uml.c
@@ -44,7 +44,9 @@ struct backend_uml_data {
@ -30,7 +30,7 @@ index da20c17d9..a5e0e8179 100644
/* Test for features which are not supported by the UML backend.
* Possibly some of these should just be warnings, not errors.
*/
@@ -128,10 +131,17 @@ uml_supported (guestfs_h *g)
@@ -133,10 +136,17 @@ uml_supported (guestfs_h *g)
return true;
}
@ -48,7 +48,7 @@ index da20c17d9..a5e0e8179 100644
struct backend_uml_data *data = datav;
CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (cmdline);
int console_sock = -1, daemon_sock = -1;
@@ -491,8 +501,10 @@ launch_uml (guestfs_h *g, void *datav, const char *arg)
@@ -496,8 +506,10 @@ launch_uml (guestfs_h *g, void *datav, const char *arg)
}
g->state = CONFIG;
return -1;
@ -59,7 +59,7 @@ index da20c17d9..a5e0e8179 100644
/* This is called from the forked subprocess just before vmlinux runs,
* so it can just print the message straight to stderr, where it will
* be picked up and funnelled through the usual appliance event API.
@@ -522,6 +534,7 @@ print_vmlinux_command_line (guestfs_h *g, char **argv)
@@ -527,6 +539,7 @@ print_vmlinux_command_line (guestfs_h *g, char **argv)
fputc ('\n', stderr);
}
@ -68,5 +68,5 @@ index da20c17d9..a5e0e8179 100644
static int
shutdown_uml (guestfs_h *g, void *datav, int check_for_errors)
--
2.18.4
2.31.1

View File

@ -1,121 +0,0 @@
From 5c5cc8b7bc2588c04dd0d0472b466f978f8ac55c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:17:35 +0000
Subject: [PATCH] ocaml: Use caml_alloc_initialized_string instead of memcpy.
See this commit in libguestfs-common:
https://github.com/libguestfs/libguestfs-common/commit/398dc56a6cb5d6d01506338fa94ef580e668d5e9
(cherry picked from commit 9f3148c791a970b7d6adf249e949a1b7e0b4b0c1)
---
generator/OCaml.ml | 10 ++++------
m4/guestfs-ocaml.m4 | 18 ++++++++++++++++++
ocaml/guestfs-c.c | 3 +--
ocaml/guestfs-c.h | 18 ++++++++++++++++++
4 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index bd4f73b85..1b6970f6d 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -504,12 +504,11 @@ copy_table (char * const * argv)
| name, FString ->
pr " v = caml_copy_string (%s->%s);\n" typ name
| name, FBuffer ->
- pr " v = caml_alloc_string (%s->%s_len);\n" typ name;
- pr " memcpy (String_val (v), %s->%s, %s->%s_len);\n"
+ pr " v = caml_alloc_initialized_string (%s->%s_len, %s->%s);\n"
typ name typ name
| name, FUUID ->
- pr " v = caml_alloc_string (32);\n";
- pr " memcpy (String_val (v), %s->%s, 32);\n" typ name
+ pr " v = caml_alloc_initialized_string (32, %s->%s);\n"
+ typ name
| name, (FBytes|FInt64|FUInt64) ->
pr " v = caml_copy_int64 (%s->%s);\n" typ name
| name, (FInt32|FUInt32) ->
@@ -757,8 +756,7 @@ copy_table (char * const * argv)
pr " for (i = 0; r[i] != NULL; ++i) free (r[i]);\n";
pr " free (r);\n";
| RBufferOut _ ->
- pr " rv = caml_alloc_string (size);\n";
- pr " memcpy (String_val (rv), r, size);\n";
+ pr " rv = caml_alloc_initialized_string (size, r);\n";
pr " free (r);\n"
);
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index 3c504ce7e..90658e8c5 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -221,6 +221,24 @@ AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[
])
AC_SUBST([HIVEX_OPEN_UNSAFE_FLAG])
+dnl Check if OCaml has caml_alloc_initialized_string (added 2017).
+AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
+ test "x$enable_ocaml" = "xyes"],[
+ AC_MSG_CHECKING([for caml_alloc_initialized_string])
+ cat >conftest.c <<'EOF'
+#include <caml/alloc.h>
+int main () { char *p = (void *) caml_alloc_initialized_string; return 0; }
+EOF
+ AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CAML_ALLOC_INITIALIZED_STRING],[1],
+ [caml_alloc_initialized_string found at compile time.])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+ rm -f conftest.c conftest.o
+])
+
dnl Flags we want to pass to every OCaml compiler call.
OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3"
AC_SUBST([OCAML_WARN_ERROR])
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 3b5fb198f..18d7dd978 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -360,8 +360,7 @@ event_callback_wrapper_locked (guestfs_h *g,
ehv = Val_int (event_handle);
- bufv = caml_alloc_string (buf_len);
- memcpy (String_val (bufv), buf, buf_len);
+ bufv = caml_alloc_initialized_string (buf_len, buf);
arrayv = caml_alloc (array_len, 0);
for (i = 0; i < array_len; ++i) {
diff --git a/ocaml/guestfs-c.h b/ocaml/guestfs-c.h
index f05dbd8e7..93ad3e2bf 100644
--- a/ocaml/guestfs-c.h
+++ b/ocaml/guestfs-c.h
@@ -19,6 +19,24 @@
#ifndef GUESTFS_OCAML_C_H
#define GUESTFS_OCAML_C_H
+#include "config.h"
+
+#include <caml/alloc.h>
+#include <caml/mlvalues.h>
+
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
#define Guestfs_val(v) (*((guestfs_h **)Data_custom_val(v)))
extern void guestfs_int_ocaml_raise_error (guestfs_h *g, const char *func)
Noreturn;
--
2.18.4

View File

@ -0,0 +1,69 @@
From cb2ac63562447e2780bd7103ed060fd6013b9054 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH] RHEL 8: 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.
---
generator/c.ml | 16 ++++++++++++++++
test-data/phony-guests/make-windows-img.sh | 1 +
tests/charsets/test-charset-fidelity.c | 2 ++
3 files changed, 19 insertions(+)
diff --git a/generator/c.ml b/generator/c.ml
index 86d3b26f8..a625361a9 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -1846,6 +1846,22 @@ and generate_client_actions actions () =
check_args_validity c_name style;
trace_call name c_name style;
+ (* RHEL 8 *)
+ if name = "mount" || name = "mount_ro" || name = "mount_options" ||
+ name = "mount_vfs" then (
+ pr " if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n";
+ pr " CLEANUP_FREE char *vfs_type = guestfs_vfs_type (g, mountable);\n";
+ pr " if (vfs_type && STREQ (vfs_type, \"ntfs\")) {\n";
+ pr " error (g, \"mount: unsupported filesystem type\");\n";
+ pr " if (trace_flag)\n";
+ pr " guestfs_int_trace (g, \"%%s = %%s (error)\",\n";
+ pr " \"%s\", \"-1\");\n" name;
+ pr " return %s;\n" (string_of_errcode errcode);
+ pr " }\n";
+ pr " }\n";
+ pr "\n";
+ );
+
(* Calculate the total size of all FileIn arguments to pass
* as a progress bar hint.
*)
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
index 30908a918..73cf5144e 100755
--- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,6 +37,7 @@ fi
# Create a disk image.
guestfish <<EOF
+set-program virt-testing
sparse windows.img-t 512M
run
diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c
index 39ccc2068..2b2e2d8a9 100644
--- a/tests/charsets/test-charset-fidelity.c
+++ b/tests/charsets/test-charset-fidelity.c
@@ -94,6 +94,8 @@ main (int argc, char *argv[])
if (g == NULL)
error (EXIT_FAILURE, 0, "failed to create handle");
+ guestfs_set_program (g, "virt-testing");
+
if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1)
exit (EXIT_FAILURE);
--
2.31.1

View File

@ -1,125 +0,0 @@
From 3b4082b239ec0976b366293067e42f91d56cfcd5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:15:29 +0000
Subject: [PATCH] ocaml: Use caml_alloc_initialized_string instead of memcpy.
Since about 2017 OCaml has had a function for creating an initialized
string. This uses the function instead of caml_alloc_string + memcpy
(which doesn't work for OCaml 4.10) and defines a replacement if the
function is missing.
Note this requires configure.ac in libguestfs.git and virt-v2v.git to
define HAVE_CAML_ALLOC_INITIALIZED_STRING.
(cherry picked from commit 398dc56a6cb5d6d01506338fa94ef580e668d5e9)
---
common/mlpcre/pcre-c.c | 16 ++++++++++++++--
common/mlvisit/visit-c.c | 16 ++++++++++++++--
common/mlxml/xml-c.c | 16 ++++++++++++++--
3 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c
index 07f99b8d6..7dbba5857 100644
--- a/common/mlpcre/pcre-c.c
+++ b/common/mlpcre/pcre-c.c
@@ -39,6 +39,19 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
/* Data on the most recent match is stored in this thread-local
* variable. It is freed either by the next call to PCRE.matches or
* by (clean) thread exit.
@@ -257,8 +270,7 @@ guestfs_int_pcre_sub (value nv)
if (len < 0)
raise_pcre_error ("pcre_get_substring", len);
- strv = caml_alloc_string (len);
- memcpy (String_val (strv), str, len);
+ strv = caml_alloc_initialized_string (len, str);
CAMLreturn (strv);
}
diff --git a/common/mlvisit/visit-c.c b/common/mlvisit/visit-c.c
index 201f6d762..d5585ca94 100644
--- a/common/mlvisit/visit-c.c
+++ b/common/mlvisit/visit-c.c
@@ -35,6 +35,19 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
struct visitor_function_wrapper_args {
/* In both case we are pointing to local roots, hence why these are
* value* not value.
@@ -198,8 +211,7 @@ copy_xattr (const struct guestfs_xattr *xattr)
rv = caml_alloc (2, 0);
v = caml_copy_string (xattr->attrname);
Store_field (rv, 0, v);
- v = caml_alloc_string (xattr->attrval_len);
- memcpy (String_val (v), xattr->attrval, xattr->attrval_len);
+ v = caml_alloc_initialized_string (xattr->attrval_len, xattr->attrval);
Store_field (rv, 1, v);
CAMLreturn (rv);
}
diff --git a/common/mlxml/xml-c.c b/common/mlxml/xml-c.c
index d3db7e227..a0fa0fc3d 100644
--- a/common/mlxml/xml-c.c
+++ b/common/mlxml/xml-c.c
@@ -40,6 +40,19 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
/* xmlDocPtr type */
#define docptr_val(v) (*((xmlDocPtr *)Data_custom_val(v)))
@@ -183,8 +196,7 @@ mllib_xml_to_string (value docv, value formatv)
doc = docptr_val (docv);
xmlDocDumpFormatMemory (doc, &mem, &size, Bool_val (formatv));
- strv = caml_alloc_string (size);
- memcpy (String_val (strv), mem, size);
+ strv = caml_alloc_initialized_string (size, mem);
free (mem);
CAMLreturn (strv);
--
2.18.4

View File

@ -0,0 +1,37 @@
From dbd1eaab6a478cf0c3ea093a56b3d04c29278615 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 12 Jan 2021 10:23:11 +0000
Subject: [PATCH] build: Avoid warnings about unknown pragmas.
In commit 4bbbf03b8bc266ed2b63c461cd0945250bb134fe we started to
ignore bogus GCC 11 warnings. Unfortunately earlier versions of GCC
don't know about those pragmas so give warnings [hence errors in
developer builds] like:
tsk.c:75:32: error: unknown option after '#pragma GCC diagnostic' kind [-Werror=pragmas]
Turn off these warnings.
Updates: commit 4bbbf03b8bc266ed2b63c461cd0945250bb134fe
(cherry picked from commit 812f837c97f48ce0c26a0e02286fb9180c282923)
---
m4/guestfs-c.m4 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4
index 25ffea0d9..bbb4db464 100644
--- a/m4/guestfs-c.m4
+++ b/m4/guestfs-c.m4
@@ -108,6 +108,9 @@ gl_WARN_ADD([-Wformat-truncation=1])
dnl GCC 9 at level 2 gives apparently bogus errors when %.*s is used.
gl_WARN_ADD([-Wformat-overflow=1])
+dnl GCC < 11 gives warnings when disabling GCC 11 warnings.
+gl_WARN_ADD([-Wno-pragmas])
+
AC_SUBST([WARN_CFLAGS])
NO_SNV_CFLAGS=
--
2.31.1

View File

@ -1,32 +0,0 @@
From 96462b30d5ca6e45601512609cedfc874739137d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 5 Sep 2019 09:00:14 +0100
Subject: [PATCH] ocaml: Change calls to caml_named_value() to cope with const
value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is
declared const.
Based on Pino Toscano's original patch to ocaml-augeas.
(cherry picked from commit 74ce7332dbb9bab2a69737257f0d07c93eb9bab4)
---
generator/daemon.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/generator/daemon.ml b/generator/daemon.ml
index a4e136aaa..b67c4d20b 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -746,7 +746,7 @@ let generate_daemon_caml_stubs () =
let nr_args = List.length args_do_function in
pr "{\n";
- pr " static value *cb = NULL;\n";
+ pr " static const value *cb = NULL;\n";
pr " CAMLparam0 ();\n";
pr " CAMLlocal2 (v, retv);\n";
pr " CAMLlocalN (args, %d);\n"
--
2.18.4

View File

@ -1,34 +0,0 @@
From 93422725a0a8248d97b67cdbc20e065f5164e089 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:27:48 +0000
Subject: [PATCH] cat: Fix GCC 10 warning.
I believe this warning is bogus, but simply initializing the local
variable is enough to avoid it.
log.c: In function 'do_log':
log.c:390:7: error: 'comm_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
390 | printf (" %.*s", (int) comm_len, comm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(cherry picked from commit 4e199494c41d3240aa5c0708887b7a7513c6b6f2)
---
cat/log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cat/log.c b/cat/log.c
index 25107e25f..f8a5c85f2 100644
--- a/cat/log.c
+++ b/cat/log.c
@@ -337,7 +337,7 @@ do_log_journal (void)
while ((r = guestfs_journal_next (g)) > 0) {
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
const char *priority_str, *identifier, *comm, *pid, *message;
- size_t priority_len, identifier_len, comm_len, pid_len, message_len;
+ size_t priority_len, identifier_len, comm_len = 0, pid_len, message_len;
int priority = LOG_INFO;
int64_t ts;
--
2.18.4

View File

@ -1,4 +1,4 @@
From 4e87c9e46f9a82f4b1c65a34602a939dcaa125eb Mon Sep 17 00:00:00 2001
From 22416a2329ec531b9608c21b11ff3d53275fe7a0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 22 Feb 2021 10:18:45 +0000
Subject: [PATCH] daemon: lvm: Use lvcreate --yes to avoid interactive prompts.
@ -6,6 +6,7 @@ Subject: [PATCH] daemon: lvm: Use lvcreate --yes to avoid interactive prompts.
See https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930996
(cherry picked from commit 21cd97732c4973db835b8b6540c8ad582ebd2bda)
---
daemon/lvm.c | 2 +-
tests/regressions/Makefile.am | 2 ++
@ -14,7 +15,7 @@ Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930996
create mode 100755 tests/regressions/rhbz1930996.sh
diff --git a/daemon/lvm.c b/daemon/lvm.c
index fa815e5c1..2911c1279 100644
index 841dc4b6b..72c59c3a1 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -219,7 +219,7 @@ do_lvcreate (const char *logvol, const char *volgroup, int mbytes)
@ -27,10 +28,10 @@ index fa815e5c1..2911c1279 100644
if (r == -1) {
reply_with_error ("%s", err);
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index fbd5c0ed7..7007bf167 100644
index ecb0d68a7..c1e0ee8a9 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -51,6 +51,7 @@ EXTRA_DIST = \
@@ -49,6 +49,7 @@ EXTRA_DIST = \
rhbz1370424.sh \
rhbz1370424.xml \
rhbz1477623.sh \
@ -38,7 +39,7 @@ index fbd5c0ed7..7007bf167 100644
test-noexec-stack.pl
TESTS = \
@@ -82,6 +83,7 @@ TESTS = \
@@ -79,6 +80,7 @@ TESTS = \
rhbz1285847.sh \
rhbz1370424.sh \
rhbz1477623.sh \
@ -89,5 +90,5 @@ index 000000000..27089beaa
+
+rm $f
--
2.18.4
2.31.1

View File

@ -1,29 +0,0 @@
From 17df30b82007073a40deb37ff7f840d56a1b5bf1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:33:39 +0000
Subject: [PATCH] builder: Fix const correctness for OCaml 4.10.
String_val now returns a const char *.
(cherry picked from commit d6fcf519f2d860fe3167629f042f5ff6a4ccc40d)
---
builder/setlocale-c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builder/setlocale-c.c b/builder/setlocale-c.c
index f2ad85352..6d877e7ac 100644
--- a/builder/setlocale-c.c
+++ b/builder/setlocale-c.c
@@ -44,7 +44,8 @@ virt_builder_setlocale (value val_category, value val_name)
{
CAMLparam2 (val_category, val_name);
CAMLlocal2 (rv, rv2);
- char *ret, *locstring;
+ const char *locstring;
+ char *ret;
int category;
category = lc_string_table[Int_val (val_category)];
--
2.18.4

View File

@ -0,0 +1,113 @@
From e1b339688e5f8f2a14fe0c7e9d02ad68004e4655 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 15 Apr 2021 09:18:22 +0100
Subject: [PATCH] inspection: More reliable detection of Linux split /usr
configurations
In RHEL 8+, /usr/etc no longer exists. Since we were looking for this
directory in order to detect a separate /usr partition, those were no
longer detected, so the merging of /usr data into the root was not
being done. The result was incomplete inspection data and failure of
virt-v2v.
All Linux systems since forever have had /usr/src but not /src, so
detect this instead.
Furthermore the merging code didn't work, because we expected that the
root filesystem had a distro assigned, but in this configuration we
may need to look for that information in /usr/lib/os-release (not on
the root filesystem). This change makes the merging work even if we
have incomplete information about the root filesystem, so long as we
have an /etc/fstab entry pointing to the /usr mountpoint.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1949683
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930133
Fixes: commit 394d11be49121884295e61964ed47f5a8488c252
(cherry picked from commit 26427b9ecc64e7e5e53a1d577cef9dc080d08877)
---
daemon/inspect.ml | 33 +++++++++++++++------------------
daemon/inspect_fs.ml | 6 +++---
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/daemon/inspect.ml b/daemon/inspect.ml
index 945a476f6..fb75b4a6c 100644
--- a/daemon/inspect.ml
+++ b/daemon/inspect.ml
@@ -182,11 +182,9 @@ and check_for_duplicated_bsd_root fses =
and collect_linux_inspection_info fses =
List.map (
function
- | { role = RoleRoot { distro = Some d } } as root ->
- if d <> DISTRO_COREOS then
- collect_linux_inspection_info_for fses root
- else
- root
+ | { role = RoleRoot { distro = Some DISTRO_COREOS } } as root -> root
+ | { role = RoleRoot _ } as root ->
+ collect_linux_inspection_info_for fses root
| fs -> fs
) fses
@@ -196,29 +194,28 @@ and collect_linux_inspection_info fses =
* or other ways to identify the OS).
*)
and collect_linux_inspection_info_for fses root =
- let root_distro, root_fstab =
+ let root_fstab =
match root with
- | { role = RoleRoot { distro = Some d; fstab = f } } -> d, f
+ | { role = RoleRoot { fstab = f } } -> f
| _ -> assert false in
try
let usr =
List.find (
function
- | { role = RoleUsr { distro = d } }
- when d = Some root_distro || d = None -> true
+ | { role = RoleUsr _; fs_location = usr_mp } ->
+ (* This checks that this usr is found in the fstab of
+ * the root filesystem.
+ *)
+ List.exists (
+ fun (mountable, _) ->
+ usr_mp.mountable = mountable
+ ) root_fstab
| _ -> false
) fses in
- let usr_mountable = usr.fs_location.mountable in
-
- (* This checks that [usr] is found in the fstab of the root
- * filesystem. If not, [Not_found] is thrown.
- *)
- ignore (
- List.find (fun (mountable, _) -> usr_mountable = mountable) root_fstab
- );
-
+ eprintf "collect_linux_inspection_info_for: merging:\n%sinto:\n%s"
+ (string_of_fs usr) (string_of_fs root);
merge usr root;
root
with
diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml
index 6e00c7083..02b5a0470 100644
--- a/daemon/inspect_fs.ml
+++ b/daemon/inspect_fs.ml
@@ -164,10 +164,10 @@ and check_filesystem mountable =
()
)
(* Linux /usr? *)
- else if Is.is_dir "/etc" &&
- Is.is_dir "/bin" &&
- Is.is_dir "/share" &&
+ else if Is.is_dir "/bin" &&
Is.is_dir "/local" &&
+ Is.is_dir "/share" &&
+ Is.is_dir "/src" &&
not (Is.is_file "/etc/fstab") then (
debug_matching "Linux /usr";
role := `Usr;
--
2.31.1

View File

@ -0,0 +1,49 @@
From 791a16b049ea1ce2c450acd367fce774d9aab5b1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 31 Aug 2021 08:27:15 +0100
Subject: [PATCH] lib: Autodetect backing format for qemu-img create -b
qemu 6.1 has decided to change qemu-img create so that a backing
format (-F) is required if a backing file (-b) is specified. Since we
don't want to change the libguestfs API to force callers to specify
this because that would be an API break, autodetect it.
This is similar to commit c8c181e8d9 ("launch: libvirt: Autodetect
backing format for readonly drive overlays").
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1998820
(cherry picked from commit 45de287447bb18d59749fbfc1ec5072413090109)
---
lib/create.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/create.c b/lib/create.c
index 44a7df25f..75a4d3a28 100644
--- a/lib/create.c
+++ b/lib/create.c
@@ -255,6 +255,7 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size,
const struct guestfs_disk_create_argv *optargs)
{
const char *backingformat = NULL;
+ CLEANUP_FREE char *backingformat_free = NULL;
const char *preallocation = NULL;
const char *compat = NULL;
int clustersize = -1;
@@ -270,6 +271,14 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size,
return -1;
}
}
+ else if (backingfile) {
+ /* Since qemu 6.1, qemu-img create has requires a backing format (-F)
+ * parameter if backing file (-b) is used (RHBZ#1998820).
+ */
+ backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
+ if (!backingformat)
+ return -1;
+ }
if (optargs->bitmask & GUESTFS_DISK_CREATE_PREALLOCATION_BITMASK) {
if (STREQ (optargs->preallocation, "off") ||
STREQ (optargs->preallocation, "sparse"))
--
2.31.1

View File

@ -1,33 +0,0 @@
From 8eb9f06b156c6362a17712cfed9c629dec297a2c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:22:42 +0000
Subject: [PATCH] mlxml: Fix pointed target signedness.
xml-c.c: In function 'mllib_xml_to_string':
xml-c.c:199:47: error: pointer targets in passing argument 2 of 'caml_alloc_initialized_string' differ in signedness [-Werror=pointer-sign]
199 | strv = caml_alloc_initialized_string (size, mem);
| ^~~
| |
| xmlChar * {aka unsigned char *}
(cherry picked from commit ea10827b4cfb3cfe5f782421c01d2902e5f73f90)
---
common/mlxml/xml-c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/mlxml/xml-c.c b/common/mlxml/xml-c.c
index a0fa0fc3d..715c3bb24 100644
--- a/common/mlxml/xml-c.c
+++ b/common/mlxml/xml-c.c
@@ -196,7 +196,7 @@ mllib_xml_to_string (value docv, value formatv)
doc = docptr_val (docv);
xmlDocDumpFormatMemory (doc, &mem, &size, Bool_val (formatv));
- strv = caml_alloc_initialized_string (size, mem);
+ strv = caml_alloc_initialized_string (size, (const char *) mem);
free (mem);
CAMLreturn (strv);
--
2.18.4

View File

@ -1,126 +0,0 @@
From 83c76b6c610df17e0b9bfd9cd11deb43ebc40411 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 19 Feb 2019 10:50:01 +0100
Subject: [PATCH] common/mlpcre: add offset flag for PCRE.matches
This way it is possible to change where the matching start, instead of
always assuming it is the beginning.
(cherry picked from commit 0ed2e5c14a302d15fd3b75ee2c1cb808a06cb746)
---
common/mlpcre/PCRE.ml | 2 +-
common/mlpcre/PCRE.mli | 5 ++++-
common/mlpcre/pcre-c.c | 16 +++++++++++++---
common/mlpcre/pcre_tests.ml | 11 ++++++++---
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/common/mlpcre/PCRE.ml b/common/mlpcre/PCRE.ml
index b054928f9..33074af1c 100644
--- a/common/mlpcre/PCRE.ml
+++ b/common/mlpcre/PCRE.ml
@@ -23,7 +23,7 @@ exception Error of string * int
type regexp
external compile : ?anchored:bool -> ?caseless:bool -> ?dotall:bool -> ?extended:bool -> ?multiline:bool -> string -> regexp = "guestfs_int_pcre_compile_byte" "guestfs_int_pcre_compile"
-external matches : regexp -> string -> bool = "guestfs_int_pcre_matches"
+external matches : ?offset:int -> regexp -> string -> bool = "guestfs_int_pcre_matches"
external sub : int -> string = "guestfs_int_pcre_sub"
external subi : int -> int * int = "guestfs_int_pcre_subi"
diff --git a/common/mlpcre/PCRE.mli b/common/mlpcre/PCRE.mli
index eacb6fd90..e10d512fc 100644
--- a/common/mlpcre/PCRE.mli
+++ b/common/mlpcre/PCRE.mli
@@ -62,7 +62,7 @@ val compile : ?anchored:bool -> ?caseless:bool -> ?dotall:bool -> ?extended:bool
See pcreapi(3) for details of what they do.
All flags default to false. *)
-val matches : regexp -> string -> bool
+val matches : ?offset:int -> regexp -> string -> bool
(** Test whether the regular expression matches the string. This
returns true if the regexp matches or false otherwise.
@@ -71,6 +71,9 @@ val matches : regexp -> string -> bool
or the thread/program exits. You can call {!sub} to return
these substrings.
+ The [?offset] flag is used to change the start of the search,
+ which by default is at the beginning of the string (position 0).
+
This can raise {!Error} if PCRE returns an error. *)
val sub : int -> string
diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c
index 7dbba5857..ec3a6f00d 100644
--- a/common/mlpcre/pcre-c.c
+++ b/common/mlpcre/pcre-c.c
@@ -133,6 +133,15 @@ is_Some_true (value v)
Bool_val (Field (v, 0)) /* Some true */;
}
+static int
+Optint_val (value intv, int defval)
+{
+ if (intv == Val_int (0)) /* None */
+ return defval;
+ else /* Some int */
+ return Int_val (Field (intv, 0));
+}
+
value
guestfs_int_pcre_compile (value anchoredv, value caselessv, value dotallv,
value extendedv, value multilinev,
@@ -177,9 +186,9 @@ guestfs_int_pcre_compile_byte (value *argv, int argn)
}
value
-guestfs_int_pcre_matches (value rev, value strv)
+guestfs_int_pcre_matches (value offsetv, value rev, value strv)
{
- CAMLparam2 (rev, strv);
+ CAMLparam3 (offsetv, rev, strv);
pcre *re = Regexp_val (rev);
struct last_match *m, *oldm;
size_t len = caml_string_length (strv);
@@ -217,7 +226,8 @@ guestfs_int_pcre_matches (value rev, value strv)
caml_raise_out_of_memory ();
}
- m->r = pcre_exec (re, NULL, m->subject, len, 0, 0, m->vec, veclen);
+ m->r = pcre_exec (re, NULL, m->subject, len, Optint_val (offsetv, 0), 0,
+ m->vec, veclen);
if (m->r < 0 && m->r != PCRE_ERROR_NOMATCH) {
int ret = m->r;
free_last_match (m);
diff --git a/common/mlpcre/pcre_tests.ml b/common/mlpcre/pcre_tests.ml
index 346019c40..3e5981107 100644
--- a/common/mlpcre/pcre_tests.ml
+++ b/common/mlpcre/pcre_tests.ml
@@ -30,9 +30,9 @@ let compile ?(anchored = false) ?(caseless = false)
patt;
PCRE.compile ~anchored ~caseless ~dotall ~extended ~multiline patt
-let matches re str =
- eprintf "PCRE.matches %s ->%!" str;
- let r = PCRE.matches re str in
+let matches ?(offset = 0) re str =
+ eprintf "PCRE.matches %s, %d ->%!" str offset;
+ let r = PCRE.matches ~offset re str in
eprintf " %b\n%!" r;
r
@@ -103,6 +103,11 @@ let () =
assert (subi 1 = (2, 3));
assert (subi 2 = (3, 3));
+ assert (matches ~offset:5 re0 "aaabcabc" = true);
+ assert (sub 0 = "ab");