Compare commits

...

No commits in common. "a9-beta" and "c8-stream-rhel" have entirely different histories.

66 changed files with 9178 additions and 6486 deletions

3
.gitignore vendored
View File

@ -1,3 +1,2 @@
SOURCES/libguestfs-1.50.2.tar.gz SOURCES/libguestfs-1.44.0.tar.gz
SOURCES/libguestfs-common-1.50.2.tar.gz
SOURCES/libguestfs.keyring SOURCES/libguestfs.keyring

View File

@ -1,3 +1,2 @@
9a4fcb78ca452e1cf04f0b541d938ab1b07019a6 SOURCES/libguestfs-1.50.2.tar.gz 99d241dc4a5ba0dc6111954ed7a872e0b0bb6944 SOURCES/libguestfs-1.44.0.tar.gz
f801826d11e360a906bae5980495ac5425d709ae SOURCES/libguestfs-common-1.50.2.tar.gz
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring 1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring

View File

@ -0,0 +1,56 @@
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 +++++++
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 0d344f9df..74dd1bb4a 100644
--- a/lib/launch-unix.c
+++ b/lib/launch-unix.c
@@ -37,6 +37,12 @@
static int
launch_unix (guestfs_h *g, void *datav, const char *sockpath)
{
+ error (g,
+ "launch: In RHEL, only the 'libvirt' or 'direct' method is supported.\n"
+ "In particular, \"libguestfs live\" is not supported.");
+ return -1;
+
+#if 0
int r, daemon_sock = -1;
struct sockaddr_un addr;
uint32_t size;
@@ -106,6 +112,7 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath)
g->conn = NULL;
}
return -1;
+#endif
}
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.31.1

View File

@ -1,63 +0,0 @@
From d2e6dce96a9f197b688758f90481407e75ae11d2 Mon Sep 17 00:00:00 2001
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Date: Wed, 26 Apr 2023 15:59:44 +0300
Subject: [PATCH] daemon/selinux-relabel: don't exclude "/selinux" if it's
non-existent
Since RHBZ#726528, filesystem.rpm doesn't include /selinux. setfiles
then gives us the warning: "Can't stat exclude path "/sysroot/selinux",
No such file or directory - ignoring."
Though the warning is harmless, let's get rid of it by checking the
existence of /selinux directory.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 9ced5fac8c1f0f8ff7ed2b5671c1c7f5f0bfa875)
---
daemon/selinux-relabel.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index 976cffe3..454486c1 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include "guestfs_protocol.h"
#include "daemon.h"
@@ -37,6 +38,17 @@ optgroup_selinuxrelabel_available (void)
return prog_exists ("setfiles");
}
+static int
+dir_exists (const char *dir)
+{
+ struct stat statbuf;
+
+ if (stat (dir, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
+ return 1;
+ else
+ return 0;
+}
+
static int
setfiles_has_option (int *flag, char opt_char)
{
@@ -99,8 +111,10 @@ do_selinux_relabel (const char *specfile, const char *path,
*/
ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_dev);
ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_proc);
- ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_selinux);
ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_sys);
+ if (dir_exists (s_selinux)) {
+ ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_selinux);
+ }
/* You have to use the -m option (where available) otherwise
* setfiles puts all the mountpoints on the excludes list for no

View File

@ -0,0 +1,330 @@
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 | 182 --------------------------------------
daemon/Makefile.am | 1 -
docs/C_SOURCE_FILES | 1 -
generator/actions_core.ml | 21 -----
generator/proc_nr.ml | 2 -
gobject/Makefile.inc | 2 -
po/POTFILES | 2 -
8 files changed, 1 insertion(+), 212 deletions(-)
delete mode 100644 daemon/9p.c
diff --git a/Makefile.am b/Makefile.am
index 3df1b6a7a..36e44dfd5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,7 +78,7 @@ SUBDIRS += tests/xfs
SUBDIRS += tests/charsets
SUBDIRS += tests/xml
SUBDIRS += tests/mount-local
-SUBDIRS += tests/9p
+#SUBDIRS += tests/9p
SUBDIRS += tests/rsync
SUBDIRS += tests/bigdirs
SUBDIRS += tests/disk-labels
diff --git a/daemon/9p.c b/daemon/9p.c
deleted file mode 100644
index 743a96abd..000000000
--- a/daemon/9p.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* libguestfs - the guestfsd daemon
- * Copyright (C) 2011 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#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 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);
- if (errno != ENOENT) {
- reply_with_perror ("opendir: " BUS_PATH);
- return NULL;
- }
-
- /* If this directory doesn't exist, it probably means that
- * the virtio driver isn't loaded. Don't return an error
- * in this case, but return an empty list.
- */
- if (end_stringsbuf (&r) == -1)
- return NULL;
-
- return take_stringsbuf (&r);
- }
-
- while (1) {
- struct dirent *d;
-
- errno = 0;
- d = readdir (dir);
- if (d == NULL) break;
-
- if (STRPREFIX (d->d_name, "virtio")) {
- CLEANUP_FREE char *mount_tag_path = NULL;
- if (asprintf (&mount_tag_path, BUS_PATH "/%s/mount_tag",
- d->d_name) == -1) {
- reply_with_perror ("asprintf");
- closedir (dir);
- return NULL;
- }
-
- /* A bit unclear, but it looks like the virtio transport allows
- * 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, NULL);
- if (mount_tag == 0)
- continue;
-
- if (add_string (&r, mount_tag) == -1) {
- closedir (dir);
- return NULL;
- }
- }
- }
-
- /* Check readdir didn't fail */
- if (errno != 0) {
- reply_with_perror ("readdir: /sys/block");
- closedir (dir);
- return NULL;
- }
-
- /* Close the directory handle */
- if (closedir (dir) == -1) {
- reply_with_perror ("closedir: /sys/block");
- return NULL;
- }
-
- /* Sort the tags. */
- if (r.size > 0)
- sort_strings (r.argv, r.size);
-
- /* NULL terminate the list */
- if (end_stringsbuf (&r) == -1)
- return NULL;
-
- return take_stringsbuf (&r);
-}
-
-/* Takes optional arguments, consult optargs_bitmask. */
-int
-do_mount_9p (const char *mount_tag, const char *mountpoint, const char *options)
-{
- CLEANUP_FREE char *mp = NULL, *opts = NULL, *err = NULL;
- struct stat statbuf;
- int r;
-
- ABS_PATH (mountpoint, 0, return -1);
-
- mp = sysroot_path (mountpoint);
- if (!mp) {
- reply_with_perror ("malloc");
- return -1;
- }
-
- /* Check the mountpoint exists and is a directory. */
- if (stat (mp, &statbuf) == -1) {
- reply_with_perror ("%s", mountpoint);
- return -1;
- }
- if (!S_ISDIR (statbuf.st_mode)) {
- reply_with_perror ("%s: mount point is not a directory", mountpoint);
- return -1;
- }
-
- /* Add trans=virtio to the options. */
- if ((optargs_bitmask & GUESTFS_MOUNT_9P_OPTIONS_BITMASK) &&
- STRNEQ (options, "")) {
- if (asprintf (&opts, "trans=virtio,%s", options) == -1) {
- reply_with_perror ("asprintf");
- return -1;
- }
- }
- else {
- opts = strdup ("trans=virtio");
- if (opts == NULL) {
- reply_with_perror ("strdup");
- return -1;
- }
- }
-
- modprobe_9pnet_virtio ();
- r = command (NULL, &err,
- "mount", "-o", opts, "-t", "9p", mount_tag, mp, NULL);
- if (r == -1) {
- reply_with_error ("%s on %s: %s", mount_tag, mountpoint, err);
- return -1;
- }
-
- return 0;
-}
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 038be592c..df9dcc4ee 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -82,7 +82,6 @@ guestfsd_SOURCES = \
../common/protocol/guestfs_protocol.h \
../common/utils/cleanups.h \
../common/utils/guestfs-utils.h \
- 9p.c \
acl.c \
actions.h \
available.c \
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index cd5bd2924..831b7e25a 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -63,7 +63,6 @@ common/windows/windows.c
common/windows/windows.h
customize/crypt-c.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 806565b19..37476c93e 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -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." };
- { defaults with
- name = "list_9p"; added = (1, 11, 12);
- style = RStringList (RPlainString, "mounttags"), [], [];
- shortdesc = "list 9p filesystems";
- longdesc = "\
-List all 9p filesystems attached to the guest. A list of
-mount tags is returned." };
-
- { defaults with
- name = "mount_9p"; added = (1, 11, 12);
- style = RErr, [String (PlainString, "mounttag"); String (PlainString, "mountpoint")], [OString "options"];
- camel_name = "Mount9P";
- shortdesc = "mount 9p filesystem";
- longdesc = "\
-Mount the virtio-9p filesystem with the tag C<mounttag> on the
-directory C<mountpoint>.
-
-If required, C<trans=virtio> will be automatically added to the options.
-Any other options required can be passed in the optional C<options>
-parameter." };
-
{ defaults with
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 30e42864f..57976be36 100644
--- a/generator/proc_nr.ml
+++ b/generator/proc_nr.ml
@@ -295,8 +295,6 @@ let proc_nr = [
282, "internal_autosync";
283, "is_zero";
284, "is_zero_device";
-285, "list_9p";
-286, "mount_9p";
287, "list_dm_devices";
288, "ntfsresize";
289, "btrfs_filesystem_resize";
diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
index 650f8ddac..c4e735967 100644
--- a/gobject/Makefile.inc
+++ b/gobject/Makefile.inc
@@ -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 \
- include/guestfs-gobject/optargs-mount_9p.h \
include/guestfs-gobject/optargs-mount_local.h \
include/guestfs-gobject/optargs-ntfsclone_out.h \
include/guestfs-gobject/optargs-ntfsfix.h \
@@ -188,7 +187,6 @@ guestfs_gobject_sources= \
src/optargs-mksquashfs.c \
src/optargs-mkswap.c \
src/optargs-mktemp.c \
- src/optargs-mount_9p.c \
src/optargs-mount_local.c \
src/optargs-ntfsclone_out.c \
src/optargs-ntfsfix.c \
diff --git a/po/POTFILES b/po/POTFILES
index 69ea7134a..0782e8ceb 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -47,7 +47,6 @@ common/visit/visit.c
common/windows/windows.c
customize/crypt-c.c
customize/perl_edit-c.c
-daemon/9p.c
daemon/acl.c
daemon/augeas.c
daemon/available.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
-gobject/src/optargs-mount_9p.c
gobject/src/optargs-mount_local.c
gobject/src/optargs-ntfsclone_out.c
gobject/src/optargs-ntfsfix.c
--
2.31.1

View File

@ -1,33 +0,0 @@
From 917455b15894c6c82bd657e918ceb09cd825c9c4 Mon Sep 17 00:00:00 2001
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Date: Wed, 26 Apr 2023 15:59:45 +0300
Subject: [PATCH] daemon/selinux-relabel: search for "invalid option" in
setfiles output
'X' in the setiles' stderr doesn't necessarily mean that option 'X'
doesn't exist. For instance, when passing '-T' we get: "setfiles:
option requires an argument -- 'T'".
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 152d6e4bdf2dac88856a4ff83cf73451f897d4d4)
---
daemon/selinux-relabel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index 454486c1..60a6f48a 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -56,8 +56,9 @@ setfiles_has_option (int *flag, char opt_char)
if (*flag == -1) {
char option[] = { '-', opt_char, '\0' }; /* "-X" */
- char err_opt[] = { '\'', opt_char, '\'', '\0'}; /* "'X'" */
+ char err_opt[32]; /* "invalid option -- 'X'" */
+ snprintf(err_opt, sizeof(err_opt), "invalid option -- '%c'", opt_char);
ignore_value (command (NULL, &err, "setfiles", option, NULL));
*flag = err && strstr (err, /* "invalid option -- " */ err_opt) == NULL;
}

View File

@ -1,7 +1,7 @@
From 66b9338e3d786db28fbd853d397741c3ceb19352 Mon Sep 17 00:00:00 2001 From 4dd2f3f56a39411a255ad0a8f38081d46620dbd8 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] RHEL: Disable unsupported remote drive protocols Subject: [PATCH] RHEL 8: 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:
@ -18,7 +18,7 @@ This disables support for unsupported remote drive protocols:
Note 'nbd' is not disabled, and of course 'file' works. Note 'nbd' is not disabled, and of course 'file' works.
We hope to gradually add some of these back over the lifetime of RHEL. We hope to gradually add some of these back over the lifetime of RHEL 8.
--- ---
docs/guestfs-testing.pod | 20 ----- docs/guestfs-testing.pod | 20 -----
fish/guestfish.pod | 66 ++-------------- fish/guestfish.pod | 66 ++--------------
@ -31,7 +31,7 @@ We hope to gradually add some of these back over the lifetime of RHEL.
8 files changed, 16 insertions(+), 348 deletions(-) 8 files changed, 16 insertions(+), 348 deletions(-)
diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod
index 47f381a7..c7b44928 100644 index f558964bf..8f264ed17 100644
--- a/docs/guestfs-testing.pod --- a/docs/guestfs-testing.pod
+++ b/docs/guestfs-testing.pod +++ b/docs/guestfs-testing.pod
@@ -109,26 +109,6 @@ image. To exit, type C<exit>. @@ -109,26 +109,6 @@ image. To exit, type C<exit>.
@ -62,7 +62,7 @@ index 47f381a7..c7b44928 100644
Run L<virt-alignment-scan(1)> on guests or disk images: Run L<virt-alignment-scan(1)> on guests or disk images:
diff --git a/fish/guestfish.pod b/fish/guestfish.pod diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index ccc0825b..d36cac9d 100644 index 9f086f110..bb4167b06 100644
--- a/fish/guestfish.pod --- a/fish/guestfish.pod
+++ b/fish/guestfish.pod +++ b/fish/guestfish.pod
@@ -131,9 +131,9 @@ To list what is available do: @@ -131,9 +131,9 @@ To list what is available do:
@ -77,7 +77,7 @@ index ccc0825b..d36cac9d 100644
=head2 Remote control =head2 Remote control
@@ -1129,12 +1129,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 On the command line, you can use the I<-a> option to add network
block devices using a URI-style format, for example: block devices using a URI-style format, for example:
@ -92,7 +92,7 @@ index ccc0825b..d36cac9d 100644
The possible I<-a URI> formats are described below. The possible I<-a URI> formats are described below.
@@ -1144,40 +1144,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>. Add the local disk image (or device) called F<disk.img>.
@ -133,7 +133,7 @@ index ccc0825b..d36cac9d 100644
=head2 B<-a nbd://example.com[:port]> =head2 B<-a nbd://example.com[:port]>
=head2 B<-a nbd://example.com[:port]/exportname> =head2 B<-a nbd://example.com[:port]/exportname>
@@ -1212,35 +1178,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 ><fs> add pool/disk protocol:rbd server:tcp:example.com:port
@ -171,7 +171,7 @@ index ccc0825b..d36cac9d 100644
In this case, the password is C<pass@word>. In this case, the password is C<pass@word>.
diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
index 21d42498..ddabeb63 100755 index 21d424984..ddabeb639 100755
--- a/fish/test-add-uri.sh --- a/fish/test-add-uri.sh
+++ b/fish/test-add-uri.sh +++ b/fish/test-add-uri.sh
@@ -40,14 +40,6 @@ function fail () @@ -40,14 +40,6 @@ function fail ()
@ -220,10 +220,10 @@ index 21d42498..ddabeb63 100755
rm test-add-uri.out rm test-add-uri.out
rm test-add-uri.img rm test-add-uri.img
diff --git a/generator/actions_core.ml b/generator/actions_core.ml diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index bfb43a19..314bb0ae 100644 index 37476c93e..9f0402510 100644
--- a/generator/actions_core.ml --- a/generator/actions_core.ml
+++ b/generator/actions_core.ml +++ b/generator/actions_core.ml
@@ -350,29 +350,6 @@ F<filename> is interpreted as a local file or device. @@ -297,29 +297,6 @@ F<filename> is interpreted as a local file or device.
This is the default if the optional protocol parameter This is the default if the optional protocol parameter
is omitted. is omitted.
@ -253,7 +253,7 @@ index bfb43a19..314bb0ae 100644
=item C<protocol = \"nbd\"> =item C<protocol = \"nbd\">
Connect to the Network Block Device server. Connect to the Network Block Device server.
@@ -389,22 +366,6 @@ The C<secret> parameter may be supplied. See below. @@ -336,22 +313,6 @@ The C<secret> parameter may be supplied. See below.
See also: L<guestfs(3)/CEPH>. See also: L<guestfs(3)/CEPH>.
@ -276,7 +276,7 @@ index bfb43a19..314bb0ae 100644
=back =back
=item C<server> =item C<server>
@@ -415,13 +376,8 @@ is a list of server(s). @@ -362,13 +323,8 @@ is a list of server(s).
Protocol Number of servers required Protocol Number of servers required
-------- -------------------------- -------- --------------------------
file List must be empty or param not used at all file List must be empty or param not used at all
@ -290,7 +290,7 @@ index bfb43a19..314bb0ae 100644
Each list element is a string specifying a server. The string must be Each list element is a string specifying a server. The string must be
in one of the following formats: in one of the following formats:
@@ -437,10 +393,10 @@ for the protocol is used (see F</etc/services>). @@ -384,10 +340,10 @@ for the protocol is used (see F</etc/services>).
=item C<username> =item C<username>
@ -305,10 +305,10 @@ index bfb43a19..314bb0ae 100644
example if using the libvirt backend and if the libvirt backend is configured to 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, 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 diff --git a/lib/drives.c b/lib/drives.c
index c5a20846..efb28925 100644 index 46af66db4..c81ded5d7 100644
--- a/lib/drives.c --- a/lib/drives.c
+++ b/lib/drives.c +++ b/lib/drives.c
@@ -166,6 +166,7 @@ create_drive_non_file (guestfs_h *g, @@ -168,6 +168,7 @@ create_drive_non_file (guestfs_h *g,
return drv; return drv;
} }
@ -316,7 +316,7 @@ index c5a20846..efb28925 100644
static struct drive * static struct drive *
create_drive_curl (guestfs_h *g, create_drive_curl (guestfs_h *g,
const struct drive_create_data *data) const struct drive_create_data *data)
@@ -224,6 +225,7 @@ create_drive_gluster (guestfs_h *g, @@ -226,6 +227,7 @@ create_drive_gluster (guestfs_h *g,
return create_drive_non_file (g, data); return create_drive_non_file (g, data);
} }
@ -324,7 +324,7 @@ index c5a20846..efb28925 100644
static int static int
nbd_port (void) nbd_port (void)
@@ -292,6 +294,7 @@ create_drive_rbd (guestfs_h *g, @@ -294,6 +296,7 @@ create_drive_rbd (guestfs_h *g,
return create_drive_non_file (g, data); return create_drive_non_file (g, data);
} }
@ -332,7 +332,7 @@ index c5a20846..efb28925 100644
static struct drive * static struct drive *
create_drive_sheepdog (guestfs_h *g, create_drive_sheepdog (guestfs_h *g,
const struct drive_create_data *data) const struct drive_create_data *data)
@@ -392,6 +395,7 @@ create_drive_iscsi (guestfs_h *g, @@ -394,6 +397,7 @@ create_drive_iscsi (guestfs_h *g,
return create_drive_non_file (g, data); return create_drive_non_file (g, data);
} }
@ -340,7 +340,7 @@ index c5a20846..efb28925 100644
/** /**
* Create the special F</dev/null> drive. * Create the special F</dev/null> drive.
@@ -842,6 +846,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); drv = create_drive_file (g, &data);
} }
} }
@ -348,7 +348,7 @@ index c5a20846..efb28925 100644
else if (STREQ (protocol, "ftp")) { else if (STREQ (protocol, "ftp")) {
data.protocol = drive_protocol_ftp; data.protocol = drive_protocol_ftp;
drv = create_drive_curl (g, &data); drv = create_drive_curl (g, &data);
@@ -866,6 +871,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; data.protocol = drive_protocol_iscsi;
drv = create_drive_iscsi (g, &data); drv = create_drive_iscsi (g, &data);
} }
@ -356,7 +356,7 @@ index c5a20846..efb28925 100644
else if (STREQ (protocol, "nbd")) { else if (STREQ (protocol, "nbd")) {
data.protocol = drive_protocol_nbd; data.protocol = drive_protocol_nbd;
drv = create_drive_nbd (g, &data); drv = create_drive_nbd (g, &data);
@@ -874,6 +880,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; data.protocol = drive_protocol_rbd;
drv = create_drive_rbd (g, &data); drv = create_drive_rbd (g, &data);
} }
@ -364,7 +364,7 @@ index c5a20846..efb28925 100644
else if (STREQ (protocol, "sheepdog")) { else if (STREQ (protocol, "sheepdog")) {
data.protocol = drive_protocol_sheepdog; data.protocol = drive_protocol_sheepdog;
drv = create_drive_sheepdog (g, &data); drv = create_drive_sheepdog (g, &data);
@@ -886,6 +893,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; data.protocol = drive_protocol_tftp;
drv = create_drive_curl (g, &data); drv = create_drive_curl (g, &data);
} }
@ -373,12 +373,12 @@ index c5a20846..efb28925 100644
error (g, _("unknown protocol %s"), protocol); error (g, _("unknown protocol %s"), protocol);
drv = NULL; /*FALLTHROUGH*/ drv = NULL; /*FALLTHROUGH*/
diff --git a/lib/guestfs.pod b/lib/guestfs.pod diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index c6c8cb16..866a4638 100644 index bce9eb79f..2bb13b875 100644
--- a/lib/guestfs.pod --- a/lib/guestfs.pod
+++ b/lib/guestfs.pod +++ b/lib/guestfs.pod
@@ -723,70 +723,6 @@ a qcow2 backing file specification, libvirt does not construct an @@ -715,70 +715,6 @@ servers. The server string is documented in
ephemeral secret object from those, for Ceph authentication. Refer to L</guestfs_add_drive_opts>. The C<username> and C<secret> parameters are
L<https://bugzilla.redhat.com/2033247>. also optional, and if not given, then no authentication will be used.
-=head3 FTP, HTTP AND TFTP -=head3 FTP, HTTP AND TFTP
- -
@ -447,7 +447,7 @@ index c6c8cb16..866a4638 100644
=head3 NETWORK BLOCK DEVICE =head3 NETWORK BLOCK DEVICE
Libguestfs can access Network Block Device (NBD) disks remotely. Libguestfs can access Network Block Device (NBD) disks remotely.
@@ -849,42 +785,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677> @@ -841,42 +777,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677>
=back =back
@ -491,10 +491,10 @@ index c6c8cb16..866a4638 100644
Libguestfs has APIs for inspecting an unknown disk image to find out 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 diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
index d86a1ecd..cf7d2a0c 100755 index 3c5aa592e..f73827bd6 100755
--- a/tests/disks/test-qemu-drive-libvirt.sh --- a/tests/disks/test-qemu-drive-libvirt.sh
+++ b/tests/disks/test-qemu-drive-libvirt.sh +++ b/tests/disks/test-qemu-drive-libvirt.sh
@@ -65,34 +65,6 @@ check_output @@ -64,34 +64,6 @@ check_output
grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail ceph2 grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail ceph2
rm "$DEBUG_QEMU_FILE" rm "$DEBUG_QEMU_FILE"
@ -530,7 +530,7 @@ index d86a1ecd..cf7d2a0c 100755
$guestfish -d pool1 run ||: $guestfish -d pool1 run ||:
diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
index 12937fb3..b3e4f990 100755 index 19dd60a2f..583e031bd 100755
--- a/tests/disks/test-qemu-drive.sh --- a/tests/disks/test-qemu-drive.sh
+++ b/tests/disks/test-qemu-drive.sh +++ b/tests/disks/test-qemu-drive.sh
@@ -62,45 +62,6 @@ check_output @@ -62,45 +62,6 @@ check_output
@ -604,3 +604,6 @@ index 12937fb3..b3e4f990 100755
-check_output -check_output
-grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail -grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
-rm "$DEBUG_QEMU_FILE" -rm "$DEBUG_QEMU_FILE"
--
2.31.1

View File

@ -1,78 +0,0 @@
From d2f8308813da27f422607e5aa21fc95d113a17f0 Mon Sep 17 00:00:00 2001
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Date: Wed, 26 Apr 2023 15:59:46 +0300
Subject: [PATCH] daemon/selinux-relabel: run setfiles with "-T 0", if
supported
Since SELinux userspace v3.4 [1], setfiles command supports "-T nthreads"
option, which allows parallel execution. "-T 0" allows using as many
threads as there're available CPU cores. This might speed up the process
of filesystem relabeling in case the appliance is being run with multiple
vCPUs. The latter is true for at least v2v starting from d2b64ecc67
("v2v: Set the number of vCPUs to same as host number of pCPUs.").
For instance, when running virt-v2v-in-place on my 12-core Xeon host
with SSD, with appliance being run with 8 vCPUs (the upper limit specified
in d2b64ecc67), and on the ~150GiB disk VM (physical size on the host),
I get the following results:
./in-place/virt-v2v-in-place -i libvirt fedora37-vm -v -x
Without this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 17.94 secs
...
With this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -T 0 -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 5.88 secs
...
So in my scenario it's getting 3 times faster.
[1] https://github.com/SELinuxProject/selinux/releases/tag/3.4
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit d0d8e6738477148a7b752348f9364a3b8faed67f)
---
daemon/selinux-relabel.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index 60a6f48a..cfc5a31d 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -73,6 +73,7 @@ do_selinux_relabel (const char *specfile, const char *path,
{
static int flag_m = -1;
static int flag_C = -1;
+ static int flag_T = -1;
const char *argv[MAX_ARGS];
CLEANUP_FREE char *s_dev = NULL, *s_proc = NULL, *s_selinux = NULL,
*s_sys = NULL, *s_specfile = NULL, *s_path = NULL;
@@ -131,6 +132,17 @@ do_selinux_relabel (const char *specfile, const char *path,
if (setfiles_has_option (&flag_C, 'C'))
ADD_ARG (argv, i, "-C");
+ /* If the appliance is being run with multiple vCPUs, running setfiles
+ * in multithreading mode might speeds up the process. Option "-T" was
+ * introduced in SELinux userspace v3.4, and we need to check whether it's
+ * supported. Passing "-T 0" creates as many threads as there're available
+ * vCPU cores.
+ * https://github.com/SELinuxProject/selinux/releases/tag/3.4
+ */
+ if (setfiles_has_option (&flag_T, 'T')) {
+ ADD_ARG (argv, i, "-T"); ADD_ARG (argv, i, "0");
+ }
+
/* Relabelling in a chroot. */
if (STRNEQ (sysroot, "/")) {
ADD_ARG (argv, i, "-r");

View File

@ -0,0 +1,72 @@
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).
This isn't supported in RHEL 8.
---
lib/launch-uml.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/launch-uml.c b/lib/launch-uml.c
index 5aec50a57..8b9fcd770 100644
--- a/lib/launch-uml.c
+++ b/lib/launch-uml.c
@@ -44,7 +44,9 @@ struct backend_uml_data {
char umid[UML_UMID_LEN+1]; /* umid=<...> unique ID. */
};
+#if 0
static void print_vmlinux_command_line (guestfs_h *g, char **argv);
+#endif
/* Run uml_mkcow to create a COW overlay. */
static char *
@@ -81,6 +83,7 @@ create_cow_overlay_uml (guestfs_h *g, void *datav, struct drive *drv)
return make_cow_overlay (g, drv->src.u.path);
}
+#if 0
/* Test for features which are not supported by the UML backend.
* Possibly some of these should just be warnings, not errors.
*/
@@ -133,10 +136,17 @@ uml_supported (guestfs_h *g)
return true;
}
+#endif
static int
launch_uml (guestfs_h *g, void *datav, const char *arg)
{
+ error (g,
+ "launch: In RHEL, only the 'libvirt' or 'direct' method is supported.\n"
+ "In particular, User-Mode Linux (UML) is not supported.");
+ return -1;
+
+#if 0
struct backend_uml_data *data = datav;
CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (cmdline);
int console_sock = -1, daemon_sock = -1;
@@ -496,8 +506,10 @@ launch_uml (guestfs_h *g, void *datav, const char *arg)
}
g->state = CONFIG;
return -1;
+#endif
}
+#if 0
/* 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.
@@ -527,6 +539,7 @@ print_vmlinux_command_line (guestfs_h *g, char **argv)
fputc ('\n', stderr);
}
+#endif
static int
shutdown_uml (guestfs_h *g, void *datav, int check_for_errors)
--
2.31.1

View File

@ -1,8 +1,8 @@
From b875668bfa9f596aba2e84999c7c9921f8dcb55e Mon Sep 17 00:00:00 2001 From cb2ac63562447e2780bd7103ed060fd6013b9054 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] RHEL: Reject use of libguestfs-winsupport features except for Subject: [PATCH] RHEL 8: Reject use of libguestfs-winsupport features except
virt-* tools (RHBZ#1240276). for 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.
@ -13,7 +13,7 @@ edits.
3 files changed, 19 insertions(+) 3 files changed, 19 insertions(+)
diff --git a/generator/c.ml b/generator/c.ml diff --git a/generator/c.ml b/generator/c.ml
index 447059b8..0391dd3d 100644 index 86d3b26f8..a625361a9 100644
--- a/generator/c.ml --- a/generator/c.ml
+++ b/generator/c.ml +++ b/generator/c.ml
@@ -1846,6 +1846,22 @@ and generate_client_actions actions () = @@ -1846,6 +1846,22 @@ and generate_client_actions actions () =
@ -40,7 +40,7 @@ index 447059b8..0391dd3d 100644
* as a progress bar hint. * 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 diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
index 16debd12..1c13ddac 100755 index 30908a918..73cf5144e 100755
--- a/test-data/phony-guests/make-windows-img.sh --- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh +++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,6 +37,7 @@ fi @@ -37,6 +37,7 @@ fi
@ -52,10 +52,10 @@ index 16debd12..1c13ddac 100755
run run
diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c
index 105291dc..5ca4f3b6 100644 index 39ccc2068..2b2e2d8a9 100644
--- a/tests/charsets/test-charset-fidelity.c --- a/tests/charsets/test-charset-fidelity.c
+++ b/tests/charsets/test-charset-fidelity.c +++ b/tests/charsets/test-charset-fidelity.c
@@ -96,6 +96,8 @@ main (int argc, char *argv[]) @@ -94,6 +94,8 @@ main (int argc, char *argv[])
if (g == NULL) if (g == NULL)
error (EXIT_FAILURE, 0, "failed to create handle"); error (EXIT_FAILURE, 0, "failed to create handle");
@ -64,3 +64,6 @@ index 105291dc..5ca4f3b6 100644
if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1) if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1)
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
--
2.31.1

View File

@ -1,63 +0,0 @@
From d4be44928a40e7ca1ef6255fb04d28f2fa7fc6b6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Feb 2023 13:20:36 +0000
Subject: [PATCH] Remove virt-dib
The tool only supports an older version of the diskimage-builder
metadata, and we do not have the time or inclination to update it to a
newer version.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1910039
(cherry picked from commit 7503eeebede688409b2adf616d71a94e04b7f0d2)
---
appliance/packagelist.in | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 585d52ad..20b08c47 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -110,7 +110,6 @@ ifelse(ARCHLINUX,1,
dnl syslinux has mtools as optional dependency, but in reality it's
dnl a hard one:
mtools
- multipath-tools dnl for kpartx
nilfs-utils
ntfs-3g
ntfs-3g-system-compression
@@ -266,35 +265,6 @@ util-linux-ng
xfsprogs
zerofree
-dnl tools needed by virt-dib
-ifelse(REDHAT,1,
- qemu-img
- which
-)
-ifelse(DEBIAN,1,
- qemu-utils
-)
-ifelse(ARCHLINUX,1,
- qemu
- which
-)
-ifelse(SUSE,1,
- qemu-tools
- which
-)
-ifelse(FRUGALWARE,1,
- qemu
- which
-)
-ifelse(MAGEIA,1,
- qemu-img
- which
-)
-curl
-kpartx
-dnl (virt-dib) tools optionally used for elements
-debootstrap
-
dnl exFAT is not usually available in free software repos
exfat-fuse
exfat-utils

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

@ -0,0 +1,94 @@
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.
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 ++
tests/regressions/rhbz1930996.sh | 36 ++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
create mode 100755 tests/regressions/rhbz1930996.sh
diff --git a/daemon/lvm.c b/daemon/lvm.c
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)
snprintf (size, sizeof size, "%d", mbytes);
r = command (NULL, &err,
- "lvm", "lvcreate",
+ "lvm", "lvcreate", "--yes",
"-L", size, "-n", logvol, volgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index ecb0d68a7..c1e0ee8a9 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -49,6 +49,7 @@ EXTRA_DIST = \
rhbz1370424.sh \
rhbz1370424.xml \
rhbz1477623.sh \
+ rhbz1930996.sh \
test-noexec-stack.pl
TESTS = \
@@ -79,6 +80,7 @@ TESTS = \
rhbz1285847.sh \
rhbz1370424.sh \
rhbz1477623.sh \
+ rhbz1930996.sh \
test-big-heap \
test-noexec-stack.pl \
$(SLOW_TESTS)
diff --git a/tests/regressions/rhbz1930996.sh b/tests/regressions/rhbz1930996.sh
new file mode 100755
index 000000000..27089beaa
--- /dev/null
+++ b/tests/regressions/rhbz1930996.sh
@@ -0,0 +1,36 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2017-2021 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Regression test for:
+# https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1
+#
+# Actually a bug/change in LVM, previously we failed to create an LV
+# if the underlying disk contained a filesystem signature.
+
+set -e
+
+$TEST_FUNCTIONS
+skip_if_skipped
+skip_unless_phony_guest fedora.img
+
+f=rhbz1930996.img
+rm -f $f
+
+guestfish -N $f=lvfs vgremove VG : vgcreate VG /dev/sda1 : lvcreate LV2 VG 100
+
+rm $f
--
2.31.1

View File

@ -1,32 +0,0 @@
From d9ba056079f797483ea99394b265c9bf39769687 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 9 Feb 2023 13:38:50 +0000
Subject: [PATCH] lib: Choose q35 machine type for x86-64
This machine type is more modern than the older 'pc' type and as most
qemu development is now focused there we expect it will perform and
behave better. In almost all respects this change should make no
difference.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2168578
Acked-by: Laszlo Ersek <lersek@redhat.com>
See-also: https://listman.redhat.com/archives/libguestfs/2023-February/030645.html
(cherry picked from commit f0f8e6c5fe0c3f6d5d90534d263bded3a4dc7e8d)
---
lib/guestfs-internal.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 306f2a2e..fb55e026 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -113,6 +113,9 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr)
#define MAX_WINDOWS_EXPLORER_SIZE (4 * 1000 * 1000)
/* Machine types. */
+#if defined(__x86_64__)
+#define MACHINE_TYPE "q35"
+#endif
#ifdef __arm__
#define MACHINE_TYPE "virt"
#endif

View File

@ -1,97 +0,0 @@
From 826cf6d68e4369de3d160e91b7dad6a894469797 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 19 May 2023 16:08:48 +0200
Subject: [PATCH] LUKS-on-LVM inspection test: rename VGs and LVs
In preparation for a subsequent patch, rename "VG" to "Volume-Group", and
"LV<n>" to "Logical-Volume-<n>", in the LUKS-on-LVM inspection test.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230519140849.310774-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 58e26402334a4696fa08730eecc9098fc270ed1c)
---
test-data/phony-guests/make-fedora-img.pl | 30 +++++++++++--------
.../test-key-option-inspect-luks-on-lvm.sh | 16 +++++-----
2 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/test-data/phony-guests/make-fedora-img.pl b/test-data/phony-guests/make-fedora-img.pl
index 4c8e1499..b7dc902e 100755
--- a/test-data/phony-guests/make-fedora-img.pl
+++ b/test-data/phony-guests/make-fedora-img.pl
@@ -224,23 +224,27 @@ EOF
# Create the Volume Group on /dev/sda2.
$g->pvcreate ('/dev/sda2');
- $g->vgcreate ('VG', ['/dev/sda2']);
- $g->lvcreate ('Root', 'VG', 32);
- $g->lvcreate ('LV1', 'VG', 32);
- $g->lvcreate ('LV2', 'VG', 32);
- $g->lvcreate ('LV3', 'VG', 64);
+ $g->vgcreate ('Volume-Group', ['/dev/sda2']);
+ $g->lvcreate ('Root', 'Volume-Group', 32);
+ $g->lvcreate ('Logical-Volume-1', 'Volume-Group', 32);
+ $g->lvcreate ('Logical-Volume-2', 'Volume-Group', 32);
+ $g->lvcreate ('Logical-Volume-3', 'Volume-Group', 64);
# Format each Logical Group as a LUKS device, with a different password.
- $g->luks_format ('/dev/VG/Root', 'FEDORA-Root', 0);
- $g->luks_format ('/dev/VG/LV1', 'FEDORA-LV1', 0);
- $g->luks_format ('/dev/VG/LV2', 'FEDORA-LV2', 0);
- $g->luks_format ('/dev/VG/LV3', 'FEDORA-LV3', 0);
+ $g->luks_format ('/dev/Volume-Group/Root', 'FEDORA-Root', 0);
+ $g->luks_format ('/dev/Volume-Group/Logical-Volume-1', 'FEDORA-LV1', 0);
+ $g->luks_format ('/dev/Volume-Group/Logical-Volume-2', 'FEDORA-LV2', 0);
+ $g->luks_format ('/dev/Volume-Group/Logical-Volume-3', 'FEDORA-LV3', 0);
# Open the LUKS devices. This creates nodes like /dev/mapper/*-luks.
- $g->cryptsetup_open ('/dev/VG/Root', 'FEDORA-Root', 'Root-luks');
- $g->cryptsetup_open ('/dev/VG/LV1', 'FEDORA-LV1', 'LV1-luks');
- $g->cryptsetup_open ('/dev/VG/LV2', 'FEDORA-LV2', 'LV2-luks');
- $g->cryptsetup_open ('/dev/VG/LV3', 'FEDORA-LV3', 'LV3-luks');
+ $g->cryptsetup_open ('/dev/Volume-Group/Root',
+ 'FEDORA-Root', 'Root-luks');
+ $g->cryptsetup_open ('/dev/Volume-Group/Logical-Volume-1',
+ 'FEDORA-LV1', 'LV1-luks');
+ $g->cryptsetup_open ('/dev/Volume-Group/Logical-Volume-2',
+ 'FEDORA-LV2', 'LV2-luks');
+ $g->cryptsetup_open ('/dev/Volume-Group/Logical-Volume-3',
+ 'FEDORA-LV3', 'LV3-luks');
# Phony root filesystem.
$g->mkfs ('ext2', '/dev/mapper/Root-luks', blocksize => 4096, label => 'ROOT');
diff --git a/tests/luks/test-key-option-inspect-luks-on-lvm.sh b/tests/luks/test-key-option-inspect-luks-on-lvm.sh
index 52cd7e98..a8d72b9f 100755
--- a/tests/luks/test-key-option-inspect-luks-on-lvm.sh
+++ b/tests/luks/test-key-option-inspect-luks-on-lvm.sh
@@ -30,10 +30,10 @@ skip_unless_phony_guest fedora-luks-on-lvm.img
# Volume names.
guestfish=(guestfish --listen --ro --inspector
--add ../test-data/phony-guests/fedora-luks-on-lvm.img)
-keys_by_lvname=(--key /dev/VG/Root:key:FEDORA-Root
- --key /dev/VG/LV1:key:FEDORA-LV1
- --key /dev/VG/LV2:key:FEDORA-LV2
- --key /dev/VG/LV3:key:FEDORA-LV3)
+keys_by_lvname=(--key /dev/Volume-Group/Root:key:FEDORA-Root
+ --key /dev/Volume-Group/Logical-Volume-1:key:FEDORA-LV1
+ --key /dev/Volume-Group/Logical-Volume-2:key:FEDORA-LV2
+ --key /dev/Volume-Group/Logical-Volume-3:key:FEDORA-LV3)
# The variable assignment below will fail, and abort the script, if guestfish
# refuses to start up.
@@ -56,10 +56,10 @@ function cleanup_guestfish
trap cleanup_guestfish EXIT
# Get the UUIDs of the LUKS devices.
-uuid_root=$(guestfish --remote -- luks-uuid /dev/VG/Root)
-uuid_lv1=$( guestfish --remote -- luks-uuid /dev/VG/LV1)
-uuid_lv2=$( guestfish --remote -- luks-uuid /dev/VG/LV2)
-uuid_lv3=$( guestfish --remote -- luks-uuid /dev/VG/LV3)
+uuid_root=$(guestfish --remote -- luks-uuid /dev/Volume-Group/Root)
+uuid_lv1=$( guestfish --remote -- luks-uuid /dev/Volume-Group/Logical-Volume-1)
+uuid_lv2=$( guestfish --remote -- luks-uuid /dev/Volume-Group/Logical-Volume-2)
+uuid_lv3=$( guestfish --remote -- luks-uuid /dev/Volume-Group/Logical-Volume-3)
# The actual test.
function check_filesystems

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

@ -1,46 +0,0 @@
From 56d7564eaa308ef7de44c8b2b5dfc7997140142e Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 19 May 2023 16:08:49 +0200
Subject: [PATCH] LUKS-on-LVM inspection test: test /dev/mapper/VG-LV
translation
In the LUKS-on-LVM inspection test, call the "check_filesystems" function
yet another time, now with such "--key" options that exercise the recent
"/dev/mapper/VG-LV" -> "/dev/VG/LV" translation (unescaping) from
libguestfs-common.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230519140849.310774-4-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 32408a9c36165af376f9f42e7d3e158d3da2c76e)
---
.../test-key-option-inspect-luks-on-lvm.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/luks/test-key-option-inspect-luks-on-lvm.sh b/tests/luks/test-key-option-inspect-luks-on-lvm.sh
index a8d72b9f..932862b1 100755
--- a/tests/luks/test-key-option-inspect-luks-on-lvm.sh
+++ b/tests/luks/test-key-option-inspect-luks-on-lvm.sh
@@ -101,3 +101,21 @@ eval "$fish_ref"
# Repeat the test.
check_filesystems
+
+# Exit the current guestfish background process.
+guestfish --remote -- exit
+GUESTFISH_PID=
+
+# Start up another guestfish background process, and specify the keys in
+# /dev/mapper/VG-LV format this time.
+keys_by_mapper_lvname=(
+ --key /dev/mapper/Volume--Group-Root:key:FEDORA-Root
+ --key /dev/mapper/Volume--Group-Logical--Volume--1:key:FEDORA-LV1
+ --key /dev/mapper/Volume--Group-Logical--Volume--2:key:FEDORA-LV2
+ --key /dev/mapper/Volume--Group-Logical--Volume--3:key:FEDORA-LV3
+)
+fish_ref=$("${guestfish[@]}" "${keys_by_mapper_lvname[@]}")
+eval "$fish_ref"
+
+# Repeat the test.
+check_filesystems

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

@ -0,0 +1,44 @@
From 3435938f43ca3737ec1d73da4d8cad756b5c9508 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 26 Mar 2021 16:04:43 +0000
Subject: [PATCH] daemon: chroot: Fix long-standing possible deadlock.
The child (chrooted) process wrote its answer on the pipe and then
exited. Meanwhile the parent waiting for the child to exit before
reading from the pipe. Thus if the output was larger than a Linux
pipebuffer then the whole thing would deadlock.
(cherry picked from commit 94e64b28bee3b8dc7ed354a366d6a8f7ba5f245c)
---
daemon/chroot.ml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/daemon/chroot.ml b/daemon/chroot.ml
index 5e856c91f..7da8ae29e 100644
--- a/daemon/chroot.ml
+++ b/daemon/chroot.ml
@@ -62,6 +62,10 @@ let f t func arg =
(* Parent. *)
close wfd;
+ let chan = in_channel_of_descr rfd in
+ let ret = input_value chan in
+ close_in chan;
+
let _, status = waitpid [] pid in
(match status with
| WEXITED 0 -> ()
@@ -76,10 +80,6 @@ let f t func arg =
failwithf "chroot %s stopped by signal %d" t.name i
);
- let chan = in_channel_of_descr rfd in
- let ret = input_value chan in
- close_in chan;
-
match ret with
| Either ret -> ret
| Or exn -> raise exn
--
2.31.1

View File

@ -1,62 +0,0 @@
From 744a257083ccc30e6b7bae40acc04eb45a59a971 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 22 May 2023 17:15:39 +0100
Subject: [PATCH] fuse: Don't call fclose(NULL) on error paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Various errors like this:
In function test_fuse,
inlined from main at test-fuse.c:133:11:
test-fuse.c:274:5: error: argument 1 null where non-null expected [-Werror=nonnull]
274 | fclose (fp);
| ^~~~~~~~~~~
In file included from test-fuse.c:26:
/usr/include/stdio.h: In function main:
/usr/include/stdio.h:183:12: note: in a call to function fclose declared nonnull
183 | extern int fclose (FILE *__stream) __nonnull ((1));
| ^~~~~~
(cherry picked from commit ca20f27cb0898c347e49b543a8acdfb0a8a8fa7e)
---
fuse/test-fuse.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/fuse/test-fuse.c b/fuse/test-fuse.c
index 9c0db594..90a78dc7 100644
--- a/fuse/test-fuse.c
+++ b/fuse/test-fuse.c
@@ -271,7 +271,6 @@ test_fuse (void)
fp = fopen ("hello.txt", "r");
if (fp == NULL) {
perror ("open: hello.txt");
- fclose (fp);
return -1;
}
if (getline (&line, &len, fp) == -1) {
@@ -289,7 +288,6 @@ test_fuse (void)
fp = fopen ("world.txt", "r");
if (fp == NULL) {
perror ("open: world.txt");
- fclose (fp);
return -1;
}
if (getline (&line, &len, fp) == -1) {
@@ -352,7 +350,6 @@ test_fuse (void)
fp = fopen ("new", "w");
if (fp == NULL) {
perror ("open: new");
- fclose (fp);
return -1;
}
fclose (fp);
@@ -615,7 +612,6 @@ test_fuse (void)
fp = fopen ("new.txt", "w");
if (fp == NULL) {
perror ("open: new.txt");
- fclose (fp);
return -1;
}
for (u = 0; u < 1000; ++u) {

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +0,0 @@
From 8aafa0631b55ec92ba1fae34d94500dd1e027083 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6tzel?= <juergen@archlinux.org>
Date: Sat, 27 May 2023 15:32:36 +0200
Subject: [PATCH] ocaml/implicit_close test: collect all currently unreachable
blocks
Fixes failing implice_close test on OCaml 5.
RWMJ:
I adjusted this patch so that we continue to call Gc.compact on
exiting the test, to move all of the heap (hopefully revealing flaws
in the bindings). This only works on OCaml <= 4, but Gc.compact may
be fixed/reimplemented later in the 5.x series.
Please see also the lengthy discussion of this patch upstream:
https://listman.redhat.com/archives/libguestfs/2023-May/thread.html#31639
https://listman.redhat.com/archives/libguestfs/2023-June/thread.html#31709
https://discuss.ocaml.org/t/ocaml-heap-fsck-and-forcing-collection-of-unreachable-objects/12281/1
(cherry picked from commit 1274452d225da71f115e0cb8ad435e02670dc4fb)
---
ocaml/t/guestfs_065_implicit_close.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml
index 567e550b..f2dfecbd 100644
--- a/ocaml/t/guestfs_065_implicit_close.ml
+++ b/ocaml/t/guestfs_065_implicit_close.ml
@@ -30,7 +30,7 @@ let () =
*)
(* This should cause the GC to close the handle. *)
-let () = Gc.compact ()
+let () = Gc.full_major ()
let () = assert (!close_invoked = 1)

View File

@ -0,0 +1,36 @@
From 3ce392c9870a589cc50d2270fcf07b4d129c3dc3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 27 Mar 2021 09:31:00 +0000
Subject: [PATCH] inspection: Return RPM epoch.
Fixes: commit c9ee831affed55abe0f928134cbbd2ed83b2f510
(cherry picked from commit fef73bce7eec0ce0753a2e150e4e088020d38643)
---
daemon/rpm-c.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/daemon/rpm-c.c b/daemon/rpm-c.c
index 92a3abf58..be0e81e22 100644
--- a/daemon/rpm-c.c
+++ b/daemon/rpm-c.c
@@ -108,13 +108,16 @@ guestfs_int_daemon_rpm_next_application (value unitv)
h = headerLink (h);
app.app2_name = headerFormat (h, "%{NAME}", NULL);
- // XXXapp.app2_epoch = headerFormat (h, "%{NAME}", NULL);
app.app2_version = headerFormat (h, "%{VERSION}", NULL);
app.app2_release = headerFormat (h, "%{RELEASE}", NULL);
app.app2_arch = headerFormat (h, "%{ARCH}", NULL);
app.app2_url = headerFormat (h, "%{URL}", NULL);
app.app2_summary = headerFormat (h, "%{SUMMARY}", NULL);
app.app2_description = headerFormat (h, "%{DESCRIPTION}", NULL);
+
+ /* epoch is special as the only int field. */
+ app.app2_epoch = headerGetNumber (h, RPMTAG_EPOCH);
+
headerFree (h);
/* Convert this to an OCaml struct. Any NULL fields must be turned
--
2.31.1

View File

@ -1,70 +0,0 @@
From 25108090a1566bc49caab833fe1591a0c6f941be Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 27 Jun 2023 10:17:58 +0100
Subject: [PATCH] ocaml: Replace old enter/leave_blocking_section calls
Since OCaml 4 the old and confusing caml_enter_blocking_section and
caml_leave_blocking_section calls have been replaced with
caml_release_runtime_system and caml_acquire_runtime_system (in that
order). Use the new names.
(cherry picked from commit 7e1d7c1330185a1f3da2ce2100f59637518c3302)
---
generator/OCaml.ml | 5 +++--
ocaml/guestfs-c.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index 02d9ee2e..07ccd269 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -429,6 +429,7 @@ and generate_ocaml_c () =
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/signals.h>
+#include <caml/threads.h>
#include <guestfs.h>
#include \"guestfs-utils.h\"
@@ -689,12 +690,12 @@ copy_table (char * const * argv)
pr "\n";
if blocking then
- pr " caml_enter_blocking_section ();\n";
+ pr " caml_release_runtime_system ();\n";
pr " r = %s " c_function;
generate_c_call_args ~handle:"g" style;
pr ";\n";
if blocking then
- pr " caml_leave_blocking_section ();\n";
+ pr " caml_acquire_runtime_system ();\n";
(* Free strings if we copied them above. *)
List.iter (
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 3888c945..8c8aa460 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -34,6 +34,7 @@
#include <caml/mlvalues.h>
#include <caml/printexc.h>
#include <caml/signals.h>
+#include <caml/threads.h>
#include <caml/unixsupport.h>
#include "guestfs-c.h"
@@ -395,12 +396,12 @@ event_callback_wrapper (guestfs_h *g,
/* Ensure we are holding the GC lock before any GC operations are
* possible. (RHBZ#725824)
*/
- caml_leave_blocking_section ();
+ caml_acquire_runtime_system ();
event_callback_wrapper_locked (g, data, event, event_handle, flags,
buf, buf_len, array, array_len);
- caml_enter_blocking_section ();
+ caml_release_runtime_system ();
}
value

View File

@ -1,28 +0,0 @@
From 166e4e90eef0d4c81a92940e5d61450d70f00662 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 27 Jun 2023 11:36:55 +0100
Subject: [PATCH] ocaml: Release runtime lock around guestfs_close
When finalizing the handle we call guestfs_close. This function could
be long-running (eg. it may have to shut down the qemu subprocess), so
release the runtime lock.
(cherry picked from commit 4a79c023e57e07844c2ac3259aaf9b885e402fdf)
---
ocaml/guestfs-c.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 8c8aa460..a1865a72 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -77,7 +77,9 @@ guestfs_finalize (value gv)
* above, which is why we don't want to delete them before
* closing the handle.
*/
+ caml_release_runtime_system ();
guestfs_close (g);
+ caml_acquire_runtime_system ();
/* Now unregister the global roots. */
if (roots && len > 0) {

File diff suppressed because it is too large Load Diff

View File

@ -1,73 +0,0 @@
From c13dd5b6d4ca94eebe32bc32993f5be0b5b373ad Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 27 Jun 2023 12:09:12 +0100
Subject: [PATCH] ocaml: Conditionally acquire the lock in callbacks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fix was originally suggested by Jürgen Hötzel (link below) which
I have lightly modified so it works with OCaml <= 4 too.
Link: https://listman.redhat.com/archives/libguestfs/2023-May/031640.html
Link: https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489
(cherry picked from commit 16464878cf980ffab1c1aeada2e438b0281ad1bc)
---
ocaml/guestfs-c.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index a1865a72..67dc3547 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -19,6 +19,7 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <errno.h>
@@ -36,6 +37,7 @@
#include <caml/signals.h>
#include <caml/threads.h>
#include <caml/unixsupport.h>
+#include <caml/version.h>
#include "guestfs-c.h"
@@ -397,13 +399,32 @@ event_callback_wrapper (guestfs_h *g,
{
/* Ensure we are holding the GC lock before any GC operations are
* possible. (RHBZ#725824)
+ *
+ * There are many paths where we already hold the OCaml lock before
+ * this function, for example "non-blocking" calls, and the
+ * libguestfs global atexit path (which calls guestfs_close). To
+ * avoid double acquisition we need to check if we already hold the
+ * lock. OCaml 5 is strict about this. In earlier OCaml versions
+ * there is no way to check, but they did not implement the lock as
+ * a mutex and so it didn't cause problems.
+ *
+ * See also:
+ * https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489
*/
- caml_acquire_runtime_system ();
+#if OCAML_VERSION_MAJOR >= 5
+ bool acquired = caml_state != NULL;
+#else
+ const bool acquired = false;
+#endif
+
+ if (!acquired)
+ caml_acquire_runtime_system ();
event_callback_wrapper_locked (g, data, event, event_handle, flags,
buf, buf_len, array, array_len);
- caml_release_runtime_system ();
+ if (!acquired)
+ caml_release_runtime_system ();
}
value

View File

@ -0,0 +1,34 @@
From 9664527c107d04aab416be87cc4fcd76dcbe5927 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Mar 2021 18:25:13 +0100
Subject: [PATCH] po/POTFILES: Fix list of files for translation.
Fixes: commit c9ee831affed55abe0f928134cbbd2ed83b2f510
(cherry picked from commit df983200d76bac37c811fbd2fb67e7ebe830e759)
---
po/POTFILES | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/po/POTFILES b/po/POTFILES
index 0782e8ceb..fdc6e8062 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -128,6 +128,7 @@ daemon/pingdaemon.c
daemon/proto.c
daemon/readdir.c
daemon/rename.c
+daemon/rpm-c.c
daemon/rsync.c
daemon/scrub.c
daemon/selinux-relabel.c
@@ -353,7 +354,6 @@ lib/command.c
lib/conn-socket.c
lib/copy-in-out.c
lib/create.c
-lib/dbdump.c
lib/drives.c
lib/errors.c
lib/event-string.c
--
2.31.1

View File

@ -0,0 +1,64 @@
From 083856d9f9c8fccc629bf0f3a5237d26434c8940 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Mar 2021 18:35:48 +0100
Subject: [PATCH] m4/guestfs-find-db-tool.m4: Remove unused file.
Fixes: commit 42e5e7cfdbca01b2e9bd50c63a9fc65b6da9192f
(cherry picked from commit 8317279c3539562ebad9de13c7ac515dded74e4d)
---
m4/guestfs-find-db-tool.m4 | 43 --------------------------------------
1 file changed, 43 deletions(-)
delete mode 100644 m4/guestfs-find-db-tool.m4
diff --git a/m4/guestfs-find-db-tool.m4 b/m4/guestfs-find-db-tool.m4
deleted file mode 100644
index b404148c6..000000000
--- a/m4/guestfs-find-db-tool.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-# libguestfs
-# Copyright (C) 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-AC_DEFUN([GUESTFS_FIND_DB_TOOL],[
- pushdef([VARIABLE],$1)
- TOOL=$2
-
- db_tool_name="db_$TOOL"
- db_versions="53 5.3 5.2 5.1 4.8 4.7 4.6"
- db_tool_patterns="dbX_$TOOL dbX.Y_$TOOL"
- db_tool_patterns="dbX_$TOOL db_$TOOL-X dbX.Y_$TOOL db_$TOOL-X.Y"
-
- AC_ARG_VAR(VARIABLE, [Absolute path to $db_tool_name executable])
-
- AS_IF(test -z "$VARIABLE", [
- exe_list="db_$TOOL"
- for ver in $db_versions ; do
- ver_maj=`echo $ver | cut -d. -f1`
- ver_min=`echo $ver | cut -d. -f2`
- for pattern in $db_tool_patterns ; do
- exe=`echo "$pattern" | sed -e "s/X/$ver_maj/g;s/Y/$ver_min/g"`
- exe_list="$exe_list $exe"
- done
- done
- AC_PATH_PROGS([]VARIABLE[], [$exe_list], [no])
- ])
-
- popdef([VARIABLE])
-])
--
2.31.1

View File

@ -1,59 +0,0 @@
From b6c9d4624899f4d81cc8d64d47ecef60aad8dd94 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 27 Jun 2023 16:20:49 +0100
Subject: [PATCH] ocaml: Fix guestfs_065_implicit_close.ml for OCaml 5
Link: https://discuss.ocaml.org/t/ocaml-5-forcing-objects-to-be-collected-and-finalized/12492/3
Thanks: Josh Berdine
Thanks: Vincent Laviron
(cherry picked from commit 7d4e9c927e8478662ece204b98ee3b5b147ab4b9)
---
ocaml/t/guestfs_065_implicit_close.ml | 33 +++++++++++++++------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml
index f2dfecbd..9e68bc4c 100644
--- a/ocaml/t/guestfs_065_implicit_close.ml
+++ b/ocaml/t/guestfs_065_implicit_close.ml
@@ -16,22 +16,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
-let close_invoked = ref 0
+let [@inline never][@local never] run () =
+ let close_invoked = ref 0 in
-let close _ _ _ _ =
- incr close_invoked
+ let close _ _ _ _ =
+ incr close_invoked
+ in
-let () =
- let g = new Guestfs.guestfs () in
- ignore (g#set_event_callback close [Guestfs.EVENT_CLOSE]);
- assert (!close_invoked = 0)
-(* Allow the 'g' handle to go out of scope here, to ensure there is no
- * reference held on the stack.
- *)
+ let () =
+ let g = new Guestfs.guestfs () in
+ ignore (g#set_event_callback close [Guestfs.EVENT_CLOSE]);
+ assert (!close_invoked = 0)
+ (* Allow the 'g' handle to go out of scope here, to ensure there is no
+ * reference held on the stack.
+ *)
+ in
-(* This should cause the GC to close the handle. *)
-let () = Gc.full_major ()
+ (* This should cause the GC to close the handle. *)
+ Gc.full_major ();
-let () = assert (!close_invoked = 1)
+ assert (!close_invoked = 1);
-let () = Gc.compact ()
+ Gc.compact ()
+
+let () = run ()

View File

@ -1,25 +0,0 @@
From ff62b8f758e16aab82960474c79a7fc10a0af3ed Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 27 Jun 2023 16:31:55 +0100
Subject: [PATCH] ocaml: Use Caml_state_opt in preference to caml_state
Link: https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489/7
Thanks: Guillaume Munch-Maccagnoni
(cherry picked from commit cade0b1aeb828d294a7c4e323f8131322d30fb73)
---
ocaml/guestfs-c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 67dc3547..8a8761e8 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -412,7 +412,7 @@ event_callback_wrapper (guestfs_h *g,
* https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489
*/
#if OCAML_VERSION_MAJOR >= 5
- bool acquired = caml_state != NULL;
+ bool acquired = Caml_state_opt != NULL;
#else
const bool acquired = false;
#endif

View File

@ -0,0 +1,474 @@
From f8ccce2c7a0c1323e0721f503322df525dd5b139 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Mar 2021 12:22:12 +0100
Subject: [PATCH] test-data/phony-guests: Fix phony RPM database, fix
virt-inspector test.
libguestfs 1.45.3 now reads the RPM database using librpm, which means
our old phony database created by db_dump can no longer work. Instead
provide a real (but very minimal) sqlite database.
This commit also fixes the virt-inspector test since the RPM database
contents are now different.
(cherry picked from commit 46bf6fb473889ed28bd7220476120edcda47ae07)
---
inspector/expected-fedora-luks.img.xml | 208 +++++++++++++++++++++++--
inspector/expected-fedora.img.xml | 208 +++++++++++++++++++++++--
2 files changed, 398 insertions(+), 18 deletions(-)
diff --git a/inspector/expected-fedora-luks.img.xml b/inspector/expected-fedora-luks.img.xml
index df6060a73..72cddaf88 100644
--- a/inspector/expected-fedora-luks.img.xml
+++ b/inspector/expected-fedora-luks.img.xml
@@ -30,22 +30,212 @@
</filesystems>
<applications>
<application>
- <name>test1</name>
- <version>1.0</version>
- <release>1.fc14</release>
+ <name>basesystem</name>
+ <version>11</version>
+ <release>10.fc33</release>
+ <arch>noarch</arch>
+ <url>(none)</url>
+ <summary>The skeleton package which defines a simple Fedora system</summary>
+ <description>Basesystem defines the components of a basic Fedora system
+(for example, the package installation order to use during bootstrapping).
+Basesystem should be in every installation of a system, and it
+should never be removed.</description>
+ </application>
+ <application>
+ <name>bash</name>
+ <version>5.0.17</version>
+ <release>2.fc33</release>
+ <arch>x86_64</arch>
+ <url>https://www.gnu.org/software/bash</url>
+ <summary>The GNU Bourne Again shell</summary>
+ <description>The GNU Bourne Again shell (Bash) is a shell or command language
+interpreter that is compatible with the Bourne shell (sh). Bash
+incorporates useful features from the Korn shell (ksh) and the C shell
+(csh). Most sh scripts can be run by bash without modification.</description>
+ </application>
+ <application>
+ <name>fedora-gpg-keys</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora RPM keys</summary>
+ <description>This package provides the RPM signature keys.</description>
+ </application>
+ <application>
+ <name>fedora-release</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora release files</summary>
+ <description>Fedora release files such as various /etc/ files that define the release
+and systemd preset files that determine which services are enabled by default.</description>
+ </application>
+ <application>
+ <name>fedora-release-common</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora release files</summary>
+ <description>Release files common to all Editions and Spins of Fedora</description>
+ </application>
+ <application>
+ <name>fedora-release-identity-basic</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Package providing the basic Fedora identity</summary>
+ <description>Provides the necessary files for a Fedora installation that is not identifying
+itself as a particular Edition or Spin.</description>
+ </application>
+ <application>
+ <name>fedora-repos</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora package repositories</summary>
+ <description>Fedora package repository files for yum and dnf along with gpg public keys.</description>
+ </application>
+ <application>
+ <name>filesystem</name>
+ <version>3.14</version>
+ <release>3.fc33</release>
+ <arch>x86_64</arch>
+ <url>https://pagure.io/filesystem</url>
+ <summary>The basic directory layout for a Linux system</summary>
+ <description>The filesystem package is one of the basic packages that is installed
+on a Linux system. Filesystem contains the basic directory layout
+for a Linux operating system, including the correct permissions for
+the directories.</description>
+ </application>
+ <application>
+ <name>glibc</name>
+ <version>2.32</version>
+ <release>4.fc33</release>
+ <arch>x86_64</arch>
+ <url>http://www.gnu.org/software/glibc/</url>
+ <summary>The GNU libc libraries</summary>
+ <description>The glibc package contains standard libraries which are used by
+multiple programs on the system. In order to save disk space and
+memory, as well as to make upgrading easier, common system code is
+kept in one place and shared between programs. This particular package
+contains the most important sets of shared libraries: the standard C
+library and the standard math library. Without these two libraries, a
+Linux system will not function.</description>
+ </application>
+ <application>
+ <name>glibc-all-langpacks</name>
+ <version>2.32</version>
+ <release>4.fc33</release>
+ <arch>x86_64</arch>
+ <url>http://www.gnu.org/software/glibc/</url>
+ <summary>All language packs for glibc.</summary>
+ </application>
+ <application>
+ <name>glibc-common</name>
+ <version>2.32</version>
+ <release>4.fc33</release>
<arch>x86_64</arch>
+ <url>http://www.gnu.org/software/glibc/</url>
+ <summary>Common binaries and locale data for glibc</summary>
+ <description>The glibc-common package includes common binaries for the GNU libc
+libraries, as well as national language (locale) support.</description>
</application>
<application>
- <name>test2</name>
- <version>2.0</version>
- <release>2.fc14</release>
+ <name>gpg-pubkey</name>
+ <version>9570ff31</version>
+ <release>5e3006fb</release>
+ <arch>(none)</arch>
+ <url>(none)</url>
+ <summary>Fedora (33) &lt;fedora-33-primary@fedoraproject.org&gt; public key</summary>
+ <description>-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: rpm-4.16.1.2 (NSS-3)
+
+mQINBF4wBvsBEADQmcGbVUbDRUoXADReRmOOEMeydHghtKC9uRs9YNpGYZIB+bie
+bGYZmflQayfh/wEpO2W/IZfGpHPL42V7SbyvqMjwNls/fnXsCtf4LRofNK8Qd9fN
+kYargc9R7BEz/mwXKMiRQVx+DzkmqGWy2gq4iD0/mCyf5FdJCE40fOWoIGJXaOI1
+Tz1vWqKwLS5T0dfmi9U4Tp/XsKOZGvN8oi5h0KmqFk7LEZr1MXarhi2Va86sgxsF
+QcZEKfu5tgD0r00vXzikoSjn3qA5JW5FW07F1pGP4bF5f9J3CZbQyOjTSWMmmfTm
+2d2BURWzaDiJN9twY2yjzkoOMuPdXXvovg7KxLcQerKT+FbKbq8DySJX2rnOA77k
+UG4c9BGf/L1uBkAT8dpHLk6Uf5BfmypxUkydSWT1xfTDnw1MqxO0MsLlAHOR3J7c
+oW9kLcOLuCQn1hBEwfZv7VSWBkGXSmKfp0LLIxAFgRtv+Dh+rcMMRdJgKr1V3FU+
+rZ1+ZAfYiBpQJFPjv70vx+rGEgS801D3PJxBZUEy4Ic4ZYaKNhK9x9PRQuWcIBuW
+6eTe/6lKWZeyxCumLLdiS75mF2oTcBaWeoc3QxrPRV15eDKeYJMbhnUai/7lSrhs
+EWCkKR1RivgF4slYmtNE5ZPGZ/d61zjwn2xi4xNJVs8q9WRPMpHp0vCyMwARAQAB
+tDFGZWRvcmEgKDMzKSA8ZmVkb3JhLTMzLXByaW1hcnlAZmVkb3JhcHJvamVjdC5v
+cmc+iQI4BBMBAgAiBQJeMAb7AhsPBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAK
+CRBJ/XdJlXD/MZm2D/9kriL43vd3+0DNMeA82n2v9mSR2PQqKny39xNlYPyy/1yZ
+P/KXoa4NYSCA971LSd7lv4n/h5bEKgGHxZfttfOzOnWMVSSTfjRyM/df/NNzTUEV
+7ORA5GW18g8PEtS7uRxVBf3cLvWu5q+8jmqES5HqTAdGVcuIFQeBXFN8Gy1Jinuz
+AH8rJSdkUeZ0cehWbERq80BWM9dhad5dW+/+Gv0foFBvP15viwhWqajr8V0B8es+
+2/tHI0k86FAujV5i0rrXl5UOoLilO57QQNDZH/qW9GsHwVI+2yecLstpUNLq+EZC
+GqTZCYoxYRpl0gAMbDLztSL/8Bc0tJrCRG3tavJotFYlgUK60XnXlQzRkh9rgsfT
+EXbQifWdQMMogzjCJr0hzJ+V1d0iozdUxB2ZEgTjukOvatkB77DY1FPZRkSFIQs+
+fdcjazDIBLIxwJu5QwvTNW8lOLnJ46g4sf1WJoUdNTbR0BaC7HHj1inVWi0p7IuN
+66EPGzJOSjLK+vW+J0ncPDEgLCV74RF/0nR5fVTdrmiopPrzFuguHf9S9gYI3Zun
+Yl8FJUu4kRO6JPPTicUXWX+8XZmE94aK14RCJL23nOSi8T1eW8JLW43dCBRO8QUE
+Aso1t2pypm/1zZexJdOV8yGME3g5l2W6PLgpz58DBECgqc/kda+VWgEAp7rO2A==
+=EPL3
+-----END PGP PUBLIC KEY BLOCK-----
+</description>
+ </application>
+ <application>
+ <name>libgcc</name>
+ <version>10.2.1</version>
+ <release>9.fc33</release>
<arch>x86_64</arch>
+ <url>http://gcc.gnu.org</url>
+ <summary>GCC version 10 shared support library</summary>
+ <description>This package contains GCC shared support library which is needed
+e.g. for exception handling support.</description>
+ </application>
+ <application>
+ <name>ncurses-base</name>
+ <version>6.2</version>
+ <release>3.20200222.fc33</release>
+ <arch>noarch</arch>
+ <url>https://invisible-island.net/ncurses/ncurses.html</url>
+ <summary>Descriptions of common terminals</summary>
+ <description>This package contains descriptions of common terminals. Other terminal
+descriptions are included in the ncurses-term package.</description>
</application>
<application>
- <name>test3</name>
- <version>3.0</version>
- <release>3.fc14</release>
+ <name>ncurses-libs</name>
+ <version>6.2</version>
+ <release>3.20200222.fc33</release>
<arch>x86_64</arch>
+ <url>https://invisible-island.net/ncurses/ncurses.html</url>
+ <summary>Ncurses libraries</summary>
+ <description>The curses library routines are a terminal-independent method of
+updating character screens with reasonable optimization. The ncurses
+(new curses) library is a freely distributable replacement for the
+discontinued 4.4 BSD classic curses library.
+
+This package contains the ncurses libraries.</description>
+ </application>
+ <application>
+ <name>setup</name>
+ <version>2.13.7</version>
+ <release>2.fc33</release>
+ <arch>noarch</arch>
+ <url>https://pagure.io/setup/</url>
+ <summary>A set of system configuration and setup files</summary>
+ <description>The setup package contains a set of important system configuration and
+setup files, such as passwd, group, and profile.</description>
+ </application>
+ <application>
+ <name>tzdata</name>
+ <version>2021a</version>
+ <release>1.fc33</release>
+ <arch>noarch</arch>
+ <url>https://www.iana.org/time-zones</url>
+ <summary>Timezone data</summary>
+ <description>This package contains data files with rules for various timezones around
+the world.</description>
</application>
</applications>
</operatingsystem>
diff --git a/inspector/expected-fedora.img.xml b/inspector/expected-fedora.img.xml
index df6060a73..72cddaf88 100644
--- a/inspector/expected-fedora.img.xml
+++ b/inspector/expected-fedora.img.xml
@@ -30,22 +30,212 @@
</filesystems>
<applications>
<application>
- <name>test1</name>
- <version>1.0</version>
- <release>1.fc14</release>
+ <name>basesystem</name>
+ <version>11</version>
+ <release>10.fc33</release>
+ <arch>noarch</arch>
+ <url>(none)</url>
+ <summary>The skeleton package which defines a simple Fedora system</summary>
+ <description>Basesystem defines the components of a basic Fedora system
+(for example, the package installation order to use during bootstrapping).
+Basesystem should be in every installation of a system, and it
+should never be removed.</description>
+ </application>
+ <application>
+ <name>bash</name>
+ <version>5.0.17</version>
+ <release>2.fc33</release>
+ <arch>x86_64</arch>
+ <url>https://www.gnu.org/software/bash</url>
+ <summary>The GNU Bourne Again shell</summary>
+ <description>The GNU Bourne Again shell (Bash) is a shell or command language
+interpreter that is compatible with the Bourne shell (sh). Bash
+incorporates useful features from the Korn shell (ksh) and the C shell
+(csh). Most sh scripts can be run by bash without modification.</description>
+ </application>
+ <application>
+ <name>fedora-gpg-keys</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora RPM keys</summary>
+ <description>This package provides the RPM signature keys.</description>
+ </application>
+ <application>
+ <name>fedora-release</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora release files</summary>
+ <description>Fedora release files such as various /etc/ files that define the release
+and systemd preset files that determine which services are enabled by default.</description>
+ </application>
+ <application>
+ <name>fedora-release-common</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora release files</summary>
+ <description>Release files common to all Editions and Spins of Fedora</description>
+ </application>
+ <application>
+ <name>fedora-release-identity-basic</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Package providing the basic Fedora identity</summary>
+ <description>Provides the necessary files for a Fedora installation that is not identifying
+itself as a particular Edition or Spin.</description>
+ </application>
+ <application>
+ <name>fedora-repos</name>
+ <version>33</version>
+ <release>3</release>
+ <arch>noarch</arch>
+ <url>https://fedoraproject.org/</url>
+ <summary>Fedora package repositories</summary>
+ <description>Fedora package repository files for yum and dnf along with gpg public keys.</description>
+ </application>
+ <application>
+ <name>filesystem</name>
+ <version>3.14</version>
+ <release>3.fc33</release>
+ <arch>x86_64</arch>
+ <url>https://pagure.io/filesystem</url>
+ <summary>The basic directory layout for a Linux system</summary>
+ <description>The filesystem package is one of the basic packages that is installed
+on a Linux system. Filesystem contains the basic directory layout
+for a Linux operating system, including the correct permissions for
+the directories.</description>
+ </application>
+ <application>
+ <name>glibc</name>
+ <version>2.32</version>
+ <release>4.fc33</release>
+ <arch>x86_64</arch>
+ <url>http://www.gnu.org/software/glibc/</url>
+ <summary>The GNU libc libraries</summary>
+ <description>The glibc package contains standard libraries which are used by
+multiple programs on the system. In order to save disk space and
+memory, as well as to make upgrading easier, common system code is
+kept in one place and shared between programs. This particular package
+contains the most important sets of shared libraries: the standard C
+library and the standard math library. Without these two libraries, a
+Linux system will not function.</description>
+ </application>
+ <application>
+ <name>glibc-all-langpacks</name>
+ <version>2.32</version>
+ <release>4.fc33</release>
+ <arch>x86_64</arch>
+ <url>http://www.gnu.org/software/glibc/</url>
+ <summary>All language packs for glibc.</summary>
+ </application>
+ <application>
+ <name>glibc-common</name>
+ <version>2.32</version>
+ <release>4.fc33</release>
<arch>x86_64</arch>
+ <url>http://www.gnu.org/software/glibc/</url>
+ <summary>Common binaries and locale data for glibc</summary>
+ <description>The glibc-common package includes common binaries for the GNU libc
+libraries, as well as national language (locale) support.</description>
</application>
<application>
- <name>test2</name>
- <version>2.0</version>
- <release>2.fc14</release>
+ <name>gpg-pubkey</name>
+ <version>9570ff31</version>
+ <release>5e3006fb</release>
+ <arch>(none)</arch>
+ <url>(none)</url>
+ <summary>Fedora (33) &lt;fedora-33-primary@fedoraproject.org&gt; public key</summary>
+ <description>-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: rpm-4.16.1.2 (NSS-3)
+
+mQINBF4wBvsBEADQmcGbVUbDRUoXADReRmOOEMeydHghtKC9uRs9YNpGYZIB+bie
+bGYZmflQayfh/wEpO2W/IZfGpHPL42V7SbyvqMjwNls/fnXsCtf4LRofNK8Qd9fN
+kYargc9R7BEz/mwXKMiRQVx+DzkmqGWy2gq4iD0/mCyf5FdJCE40fOWoIGJXaOI1
+Tz1vWqKwLS5T0dfmi9U4Tp/XsKOZGvN8oi5h0KmqFk7LEZr1MXarhi2Va86sgxsF
+QcZEKfu5tgD0r00vXzikoSjn3qA5JW5FW07F1pGP4bF5f9J3CZbQyOjTSWMmmfTm
+2d2BURWzaDiJN9twY2yjzkoOMuPdXXvovg7KxLcQerKT+FbKbq8DySJX2rnOA77k
+UG4c9BGf/L1uBkAT8dpHLk6Uf5BfmypxUkydSWT1xfTDnw1MqxO0MsLlAHOR3J7c
+oW9kLcOLuCQn1hBEwfZv7VSWBkGXSmKfp0LLIxAFgRtv+Dh+rcMMRdJgKr1V3FU+
+rZ1+ZAfYiBpQJFPjv70vx+rGEgS801D3PJxBZUEy4Ic4ZYaKNhK9x9PRQuWcIBuW
+6eTe/6lKWZeyxCumLLdiS75mF2oTcBaWeoc3QxrPRV15eDKeYJMbhnUai/7lSrhs
+EWCkKR1RivgF4slYmtNE5ZPGZ/d61zjwn2xi4xNJVs8q9WRPMpHp0vCyMwARAQAB
+tDFGZWRvcmEgKDMzKSA8ZmVkb3JhLTMzLXByaW1hcnlAZmVkb3JhcHJvamVjdC5v
+cmc+iQI4BBMBAgAiBQJeMAb7AhsPBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAK
+CRBJ/XdJlXD/MZm2D/9kriL43vd3+0DNMeA82n2v9mSR2PQqKny39xNlYPyy/1yZ
+P/KXoa4NYSCA971LSd7lv4n/h5bEKgGHxZfttfOzOnWMVSSTfjRyM/df/NNzTUEV
+7ORA5GW18g8PEtS7uRxVBf3cLvWu5q+8jmqES5HqTAdGVcuIFQeBXFN8Gy1Jinuz
+AH8rJSdkUeZ0cehWbERq80BWM9dhad5dW+/+Gv0foFBvP15viwhWqajr8V0B8es+
+2/tHI0k86FAujV5i0rrXl5UOoLilO57QQNDZH/qW9GsHwVI+2yecLstpUNLq+EZC
+GqTZCYoxYRpl0gAMbDLztSL/8Bc0tJrCRG3tavJotFYlgUK60XnXlQzRkh9rgsfT
+EXbQifWdQMMogzjCJr0hzJ+V1d0iozdUxB2ZEgTjukOvatkB77DY1FPZRkSFIQs+
+fdcjazDIBLIxwJu5QwvTNW8lOLnJ46g4sf1WJoUdNTbR0BaC7HHj1inVWi0p7IuN
+66EPGzJOSjLK+vW+J0ncPDEgLCV74RF/0nR5fVTdrmiopPrzFuguHf9S9gYI3Zun
+Yl8FJUu4kRO6JPPTicUXWX+8XZmE94aK14RCJL23nOSi8T1eW8JLW43dCBRO8QUE
+Aso1t2pypm/1zZexJdOV8yGME3g5l2W6PLgpz58DBECgqc/kda+VWgEAp7rO2A==
+=EPL3
+-----END PGP PUBLIC KEY BLOCK-----
+</description>
+ </application>
+ <application>
+ <name>libgcc</name>
+ <version>10.2.1</version>
+ <release>9.fc33</release>
<arch>x86_64</arch>
+ <url>http://gcc.gnu.org</url>
+ <summary>GCC version 10 shared support library</summary>
+ <description>This package contains GCC shared support library which is needed
+e.g. for exception handling support.</description>
+ </application>
+ <application>
+ <name>ncurses-base</name>
+ <version>6.2</version>
+ <release>3.20200222.fc33</release>
+ <arch>noarch</arch>
+ <url>https://invisible-island.net/ncurses/ncurses.html</url>
+ <summary>Descriptions of common terminals</summary>
+ <description>This package contains descriptions of common terminals. Other terminal
+descriptions are included in the ncurses-term package.</description>
</application>
<application>
- <name>test3</name>
- <version>3.0</version>
- <release>3.fc14</release>
+ <name>ncurses-libs</name>
+ <version>6.2</version>
+ <release>3.20200222.fc33</release>
<arch>x86_64</arch>
+ <url>https://invisible-island.net/ncurses/ncurses.html</url>
+ <summary>Ncurses libraries</summary>
+ <description>The curses library routines are a terminal-independent method of
+updating character screens with reasonable optimization. The ncurses
+(new curses) library is a freely distributable replacement for the
+discontinued 4.4 BSD classic curses library.
+
+This package contains the ncurses libraries.</description>
+ </application>
+ <application>
+ <name>setup</name>
+ <version>2.13.7</version>
+ <release>2.fc33</release>
+ <arch>noarch</arch>
+ <url>https://pagure.io/setup/</url>
+ <summary>A set of system configuration and setup files</summary>
+ <description>The setup package contains a set of important system configuration and
+setup files, such as passwd, group, and profile.</description>
+ </application>
+ <application>
+ <name>tzdata</name>
+ <version>2021a</version>
+ <release>1.fc33</release>
+ <arch>noarch</arch>
+ <url>https://www.iana.org/time-zones</url>
+ <summary>Timezone data</summary>
+ <description>This package contains data files with rules for various timezones around
+the world.</description>
</application>
</applications>
</operatingsystem>
--
2.31.1

View File

@ -1,398 +0,0 @@
From 0be1035c710d95aeca68a10fe9a7b4b740ae7aff Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 29 Jun 2023 13:33:04 +0100
Subject: [PATCH] generator: Add --chown option for virt-customize
Also this updates the common submodule to include the changes.
Fixes: https://github.com/rwmjones/guestfs-tools/issues/12
Acked-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit d8e48bff212f9b0558480ffedf8158157360d0d5)
---
common | 2 +-
generator/customize.ml | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
Submodule common d61cd820..bbb54714:
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index 22a96e04..22724600 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -63,6 +63,30 @@ Change the permissions of C<FILE> to C<PERMISSIONS>.
I<Note>: C<PERMISSIONS> by default would be decimal, unless you prefix
it with C<0> to get octal, ie. use C<0700> not C<700>.
+=item B<--chown> UID.GID:PATH
+
+Change the owner user and group ID of a file or directory in the guest.
+Note:
+
+=over 4
+
+=item *
+
+Only numeric UIDs and GIDs will work, and these may not be the same
+inside the guest as on the host.
+
+=item *
+
+This will not work with Windows guests.
+
+=back
+
+For example:
+
+ virt-customize --chown '0.0:/var/log/audit.log'
+
+See also: I<--upload>.
+
=item B<--commands-from-file> FILENAME
Read the customize commands from a file, one (and its arguments)
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index d04f421e..e20b12d4 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -1,15 +1,15 @@
[--append-line FILE:LINE] [--chmod PERMISSIONS:FILE]
- [--commands-from-file FILENAME] [--copy SOURCE:DEST]
- [--copy-in LOCALPATH:REMOTEDIR] [--delete PATH] [--edit FILE:EXPR]
- [--firstboot SCRIPT] [--firstboot-command 'CMD+ARGS']
- [--firstboot-install PKG,PKG..] [--hostname HOSTNAME]
- [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD]
- [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR]
- [--move SOURCE:DEST] [--password USER:SELECTOR]
- [--root-password SELECTOR] [--run SCRIPT]
- [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR]
- [--sm-register] [--sm-remove] [--sm-unregister]
- [--ssh-inject USER[:SELECTOR]] [--truncate FILE]
+ [--chown UID.GID:PATH] [--commands-from-file FILENAME]
+ [--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR]
+ [--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT]
+ [--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..]
+ [--hostname HOSTNAME] [--inject-qemu-ga METHOD]
+ [--inject-virtio-win METHOD] [--install PKG,PKG..]
+ [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST]
+ [--password USER:SELECTOR] [--root-password SELECTOR]
+ [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE]
+ [--sm-attach SELECTOR] [--sm-register] [--sm-remove]
+ [--sm-unregister] [--ssh-inject USER[:SELECTOR]] [--truncate FILE]
[--truncate-recursive PATH] [--timezone TIMEZONE] [--touch FILE]
[--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
[--write FILE:CONTENT] [--no-logfile]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 3c24315d..fd3074ad 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -41,6 +41,8 @@ and op = [
(* --append-line FILE:LINE *)
| `Chmod of string * string
(* --chmod PERMISSIONS:FILE *)
+ | `Chown of string * string
+ (* --chown UID.GID:PATH *)
| `CommandsFromFile of string
(* --commands-from-file FILENAME *)
| `Copy of string * string
@@ -187,6 +189,17 @@ let rec argspec () =
s_"Change the permissions of a file"
),
Some "PERMISSIONS:FILE", "Change the permissions of C<FILE> to C<PERMISSIONS>.\n\nI<Note>: C<PERMISSIONS> by default would be decimal, unless you prefix\nit with C<0> to get octal, ie. use C<0700> not C<700>.";
+ (
+ [ L"chown" ],
+ Getopt.String (
+ s_"UID.GID:PATH",
+ fun s ->
+ let p = split_string_pair "chown" s in
+ List.push_front (`Chown p) ops
+ ),
+ s_"Change the owner user and group ID of a file or directory"
+ ),
+ Some "UID.GID:PATH", "Change the owner user and group ID of a file or directory in the guest.\nNote:\n\n=over 4\n\n=item *\n\nOnly numeric UIDs and GIDs will work, and these may not be the same\ninside the guest as on the host.\n\n=item *\n\nThis will not work with Windows guests.\n\n=back\n\nFor example:\n\n virt-customize --chown '0.0:/var/log/audit.log'\n\nSee also: I<--upload>.";
(
[ L"commands-from-file" ],
Getopt.String (
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index 0cc166e6..5883bbe0 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -33,6 +33,8 @@ and op = [
(* --append-line FILE:LINE *)
| `Chmod of string * string
(* --chmod PERMISSIONS:FILE *)
+ | `Chown of string * string
+ (* --chown UID.GID:PATH *)
| `CommandsFromFile of string
(* --commands-from-file FILENAME *)
| `Copy of string * string
diff --git a/common/mltools/curl.ml b/common/mltools/curl.ml
index 6dba9753..73eed903 100644
--- a/common/mltools/curl.ml
+++ b/common/mltools/curl.ml
@@ -20,11 +20,13 @@ open Printf
open Std_utils
open Tools_utils
+open Common_gettext.Gettext
type t = {
curl : string;
args : args;
tmpdir : string option;
+ url : string;
}
and args = (string * string option) list
@@ -40,11 +42,17 @@ let args_of_proxy = function
| SystemProxy -> []
| ForcedProxy url -> [ "proxy", Some url; "noproxy", Some "" ]
-let create ?(curl = "curl") ?(proxy = SystemProxy) ?tmpdir args =
+let create ?(curl = "curl") ?(proxy = SystemProxy) ?tmpdir args url =
+ (* The ["url"] key must not appear in [args]. This was how the
+ * previous version of this module worked, so lets check there
+ * are no callers still doing this.
+ *)
+ List.iter (function "url", _ -> assert false | _ -> ()) args;
+
let args = safe_args @ args_of_proxy proxy @ args in
- { curl = curl; args = args; tmpdir = tmpdir }
+ { curl; args; tmpdir; url }
-let run { curl; args; tmpdir } =
+let run { curl; args; tmpdir; url } =
let config_file, chan = Filename.open_temp_file ?temp_dir:tmpdir
"guestfscurl" ".conf" in
List.iter (
@@ -67,15 +75,16 @@ let run { curl; args; tmpdir } =
| c -> output_char chan c
done;
fprintf chan "\"\n"
- ) args;
+ ) (("url", Some url) :: args);
close_out chan;
let cmd = sprintf "%s -q --config %s" (quote curl) (quote config_file) in
- let lines = external_command ~echo_cmd:false cmd in
+ let help = sprintf (f_"downloading %s") url in
+ let lines = external_command ~echo_cmd:false ~help cmd in
Unix.unlink config_file;
lines
-let to_string { curl; args } =
+let to_string { curl; args; url } =
let b = Buffer.create 128 in
bprintf b "%s -q" (quote curl);
List.iter (
@@ -85,7 +94,7 @@ let to_string { curl; args } =
| "user", Some _ -> bprintf b " --user <hidden>"
| name, Some value -> bprintf b " --%s %s" name (quote value)
) args;
- bprintf b "\n";
+ bprintf b " %s\n" (quote url);
Buffer.contents b
let print chan t = output_string chan (to_string t)
diff --git a/common/mltools/curl.mli b/common/mltools/curl.mli
index a3e98dc6..1606a79a 100644
--- a/common/mltools/curl.mli
+++ b/common/mltools/curl.mli
@@ -27,13 +27,16 @@ type proxy =
| SystemProxy (** Use the system settings. *)
| ForcedProxy of string (** The proxy is forced to the specified URL. *)
-val create : ?curl:string -> ?proxy:proxy -> ?tmpdir:string -> args -> t
+val create : ?curl:string -> ?proxy:proxy -> ?tmpdir:string -> args -> string
+ -> t
(** Create a curl command handle.
The curl arguments are a list of key, value pairs corresponding
to curl command line parameters, without leading dashes,
eg. [("user", Some "user:password")].
+ The string parameter is the URL (which is required).
+
The optional [?curl] parameter controls the name of the curl
binary (default ["curl"]).
diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml
index 8b611e77..23f16c51 100644
--- a/common/mltools/tools_utils.ml
+++ b/common/mltools/tools_utils.ml
@@ -435,8 +435,12 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false)
let getopt = Getopt.create argspec ?anon_fun usage_msg in
{ getopt; ks; debug_gc }
+let external_command_failed help cmd reason =
+ let help_prefix = match help with None -> "" | Some str -> str ^ ": " in
+ error "%s%s %s: %s" help_prefix (s_"external command") cmd reason
+
(* Run an external command, slurp up the output as a list of lines. *)
-let external_command ?(echo_cmd = true) cmd =
+let external_command ?(echo_cmd = true) ?help cmd =
if echo_cmd then
debug "%s" cmd;
let chan = Unix.open_process_in cmd in
@@ -448,15 +452,18 @@ let external_command ?(echo_cmd = true) cmd =
(match stat with
| Unix.WEXITED 0 -> ()
| Unix.WEXITED i ->
- error (f_"external command %s exited with error %d") cmd i
+ let reason = sprintf (f_"exited with error %d") i in
+ external_command_failed help cmd reason
| Unix.WSIGNALED i ->
- error (f_"external command %s killed by signal %d") cmd i
+ let reason = sprintf (f_"killed by signal %d") i in
+ external_command_failed help cmd reason
| Unix.WSTOPPED i ->
- error (f_"external command %s stopped by signal %d") cmd i
+ let reason = sprintf (f_"stopped by signal %d") i in
+ external_command_failed help cmd reason
);
lines
-let rec run_commands ?(echo_cmd = true) cmds =
+let rec run_commands ?(echo_cmd = true) ?help cmds =
let res = Array.make (List.length cmds) 0 in
let pids =
List.mapi (
@@ -482,21 +489,21 @@ let rec run_commands ?(echo_cmd = true) cmds =
let matching_pair = List.hd matching_pair in
let idx, _, app, outfd, errfd = matching_pair in
pids := new_pids;
- res.(idx) <- do_teardown app outfd errfd stat
+ res.(idx) <- do_teardown help app outfd errfd stat
);
done;
Array.to_list res
-and run_command ?(echo_cmd = true) ?stdout_fd ?stderr_fd args =
+and run_command ?(echo_cmd = true) ?help ?stdout_fd ?stderr_fd args =
let run_res = do_run args ~echo_cmd ?stdout_fd ?stderr_fd in
match run_res with
| Either (pid, app, outfd, errfd) ->
let _, stat = Unix.waitpid [] pid in
- do_teardown app outfd errfd stat
+ do_teardown help app outfd errfd stat
| Or code ->
code
-and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args =
+and do_run ?(echo_cmd = true) ?help ?stdout_fd ?stderr_fd args =
let app = List.hd args in
let get_fd default = function
| None ->
@@ -522,16 +529,18 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args =
debug "%s: %s: executable not found" app fn;
Or 127
-and do_teardown app outfd errfd exitstat =
+and do_teardown help app outfd errfd exitstat =
Option.iter Unix.close outfd;
Option.iter Unix.close errfd;
match exitstat with
| Unix.WEXITED i ->
- i
+ i
| Unix.WSIGNALED i ->
- error (f_"external command %s killed by signal %d") app i
+ let reason = sprintf (f_"killed by signal %d") i in
+ external_command_failed help app reason
| Unix.WSTOPPED i ->
- error (f_"external command %s stopped by signal %d") app i
+ let reason = sprintf (f_"stopped by signal %d") i in
+ external_command_failed help app reason
let shell_command ?(echo_cmd = true) cmd =
if echo_cmd then
diff --git a/common/mltools/tools_utils.mli b/common/mltools/tools_utils.mli
index ec900e63..193ba7b6 100644
--- a/common/mltools/tools_utils.mli
+++ b/common/mltools/tools_utils.mli
@@ -103,13 +103,17 @@ val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?k
Returns a new {!cmdline_options} structure. *)
-val external_command : ?echo_cmd:bool -> string -> string list
+val external_command : ?echo_cmd:bool -> ?help:string -> string -> string list
(** Run an external command, slurp up the output as a list of lines.
[echo_cmd] specifies whether to output the full command on verbose
- mode, and it's on by default. *)
+ mode, and it's on by default.
-val run_commands : ?echo_cmd:bool -> (string list * Unix.file_descr option * Unix.file_descr option) list -> int list
+ [help] is an optional string which is printed as a prefix in
+ case the external command fails, eg as a hint to the user about
+ what we were trying to do. *)
+
+val run_commands : ?echo_cmd:bool -> ?help:string -> (string list * Unix.file_descr option * Unix.file_descr option) list -> int list
(** Run external commands in parallel without using a shell,
and return a list with their exit codes.
@@ -126,16 +130,24 @@ val run_commands : ?echo_cmd:bool -> (string list * Unix.file_descr option * Uni
end of the execution of the command for which it was specified.
[echo_cmd] specifies whether output the full command on verbose
- mode, and it's on by default. *)
+ mode, and it's on by default.
-val run_command : ?echo_cmd:bool -> ?stdout_fd:Unix.file_descr -> ?stderr_fd:Unix.file_descr -> string list -> int
+ [help] is an optional string which is printed as a prefix in
+ case the external command fails, eg as a hint to the user about
+ what we were trying to do. *)
+
+val run_command : ?echo_cmd:bool -> ?help:string -> ?stdout_fd:Unix.file_descr -> ?stderr_fd:Unix.file_descr -> string list -> int
(** Run an external command without using a shell, and return its exit code.
If [stdout_fd] or [stderr_fd] is specified, the file descriptor
is automatically closed after executing the command.
[echo_cmd] specifies whether output the full command on verbose
- mode, and it's on by default. *)
+ mode, and it's on by default.
+
+ [help] is an optional string which is printed as a prefix in
+ case the external command fails, eg as a hint to the user about
+ what we were trying to do. *)
val shell_command : ?echo_cmd:bool -> string -> int
(** Run an external shell command, and return its exit code.
diff --git a/generator/customize.ml b/generator/customize.ml
index aa7ac8e8..8d3dec3e 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -95,6 +95,34 @@ I<Note>: C<PERMISSIONS> by default would be decimal, unless you prefix
it with C<0> to get octal, ie. use C<0700> not C<700>.";
};
+ { op_name = "chown";
+ op_type = StringPair "UID.GID:PATH";
+ op_discrim = "`Chown";
+ op_shortdesc = "Change the owner user and group ID of a file or directory";
+ op_pod_longdesc = "\
+Change the owner user and group ID of a file or directory in the guest.
+Note:
+
+=over 4
+
+=item *
+
+Only numeric UIDs and GIDs will work, and these may not be the same
+inside the guest as on the host.
+
+=item *
+
+This will not work with Windows guests.
+
+=back
+
+For example:
+
+ virt-customize --chown '0.0:/var/log/audit.log'
+
+See also: I<--upload>.";
+ };
+
{ op_name = "commands-from-file";
op_type = StringFn ("FILENAME", "customize_read_from_file");
op_discrim = "`CommandsFromFile";

View File

@ -0,0 +1,65 @@
From 6657d0c1018ab44ae680376463ac3f0421548fb4 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 23 Dec 2021 11:36:59 +0100
Subject: [PATCH] launch-libvirt: place our virtio-net-pci device in slot 0x1e
The <qemu:commandline> trick we use for adding our virtio-net-pci device
in the libvirt backend can conflict with libvirtd's and QEMU's PCI address
assignment. Try to mitigate that by placing our device in slot 0x1e on the
root bus. In practice this could only conflict with a "dmi-to-pci-bridge"
device model, which libvirtd itself places in slot 0x1e. However, given
the XMLs we generate, and modern QEMU versions, libvirtd has no reason to
auto-add "dmi-to-pci-bridge". Refer to
<https://libvirt.org/formatdomain.html#controllers>.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 5ce5ef6a97a58c5e906083ad4e944545712b3f3f)
---
lib/guestfs-internal.h | 11 +++++++++++
lib/launch-libvirt.c | 4 +++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 4799ee0a1..0b46f0070 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -147,6 +147,17 @@
#define VIRTIO_DEVICE_NAME(type) type "-pci"
#endif
+/* Place the virtio-net controller in slot 0x1e on the root bus, on normal
+ * hardware with PCI. Refer to RHBZ#2034160.
+ */
+#ifdef HAVE_LIBVIRT_BACKEND
+#if defined(__arm__) || defined(__s390x__)
+#define VIRTIO_NET_PCI_ADDR ""
+#else
+#define VIRTIO_NET_PCI_ADDR ",addr=1e.0"
+#endif
+#endif
+
/* Guestfs handle and associated structures. */
/* State. */
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index 026dc6b26..5842319df 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1834,7 +1834,9 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
} end_element ();
start_element ("qemu:arg") {
- attribute ("value", VIRTIO_DEVICE_NAME ("virtio-net") ",netdev=usernet");
+ attribute ("value", (VIRTIO_DEVICE_NAME ("virtio-net")
+ ",netdev=usernet"
+ VIRTIO_NET_PCI_ADDR));
} end_element ();
}
--
2.31.1

View File

@ -0,0 +1,70 @@
From 4b9eac11db3e2cc9ace397ed4c804356a7d9adbf Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 23 Dec 2021 11:37:00 +0100
Subject: [PATCH] lib: extract NETWORK_ADDRESS and NETWORK_PREFIX as macros
The 169.254.0.0/16 network specification (for the appliance) is currently
duplicated between the direct backend and the libvirt backend. In a
subsequent patch, we're going to need the network specification in yet
another spot; extract it now to the NETWORK_ADDRESS and NETWORK_PREFIX
macros (simply as strings).
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 216de164e091a5c36403f24901698044a43ae0d9)
---
lib/guestfs-internal.h | 6 ++++++
lib/launch-direct.c | 2 +-
lib/launch-libvirt.c | 3 ++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 0b46f0070..97a13ff2c 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -158,6 +158,12 @@
#endif
#endif
+/* Network address and network mask (expressed as address prefix) that the
+ * appliance will see (if networking is enabled).
+ */
+#define NETWORK_ADDRESS "169.254.0.0"
+#define NETWORK_PREFIX "16"
+
/* Guestfs handle and associated structures. */
/* State. */
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index b6ed9766f..de17d2167 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -681,7 +681,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
start_list ("-netdev") {
append_list ("user");
append_list ("id=usernet");
- append_list ("net=169.254.0.0/16");
+ append_list ("net=" NETWORK_ADDRESS "/" NETWORK_PREFIX);
} end_list ();
start_list ("-device") {
append_list (VIRTIO_DEVICE_NAME ("virtio-net"));
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index 5842319df..0f38f0aec 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1826,7 +1826,8 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
} end_element ();
start_element ("qemu:arg") {
- attribute ("value", "user,id=usernet,net=169.254.0.0/16");
+ attribute ("value",
+ "user,id=usernet,net=" NETWORK_ADDRESS "/" NETWORK_PREFIX);
} end_element ();
start_element ("qemu:arg") {
--
2.31.1

View File

@ -1,101 +0,0 @@
From cda24a0207fda8659790376a79fdac3d1775da83 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 11 Jul 2023 13:39:06 +0200
Subject: [PATCH] lib: remove guestfs_int_cmd_clear_close_files()
The last (only?) caller of guestfs_int_cmd_clear_close_files() disappeared
in commit e4c396888056 ("lib/info: Remove /dev/fd hacking and pass a true
filename to qemu-img info.", 2018-01-23), part of v1.37.36.
Simplify the code by removing guestfs_int_cmd_clear_close_files().
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230711113906.107340-1-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 13c7052ff96d5ee99ec1b1252f1a3b4d7aed44d2)
---
lib/command.c | 37 ++++++++++---------------------------
lib/guestfs-internal.h | 1 -
2 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/lib/command.c b/lib/command.c
index 515ef624..82a47baf 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -152,9 +152,6 @@ struct command
/* When using the pipe_* APIs, stderr is pointed to a temporary file. */
char *error_file;
- /* Close file descriptors (defaults to true). */
- bool close_files;
-
/* Supply a callback to receive stdout. */
cmd_stdout_callback stdout_callback;
void *stdout_data;
@@ -186,7 +183,6 @@ guestfs_int_new_command (guestfs_h *g)
cmd = safe_calloc (g, 1, sizeof *cmd);
cmd->g = g;
cmd->capture_errors = true;
- cmd->close_files = true;
cmd->errorfd = -1;
cmd->outfd = -1;
return cmd;
@@ -358,17 +354,6 @@ guestfs_int_cmd_clear_capture_errors (struct command *cmd)
cmd->capture_errors = false;
}
-/**
- * Don't close file descriptors after the fork.
- *
- * XXX Should allow single fds to be sent to child process.
- */
-void
-guestfs_int_cmd_clear_close_files (struct command *cmd)
-{
- cmd->close_files = false;
-}
-
/**
* Set a function to be executed in the child, right before the
* execution. Can be used to setup the child, for example changing
@@ -564,18 +549,16 @@ run_child (struct command *cmd, char **env)
for (i = 1; i < NSIG; ++i)
sigaction (i, &sa, NULL);
- if (cmd->close_files) {
- /* Close all other file descriptors. This ensures that we don't
- * hold open (eg) pipes from the parent process.
- */
- max_fd = sysconf (_SC_OPEN_MAX);
- if (max_fd == -1)
- max_fd = 1024;
- if (max_fd > 65536)
- max_fd = 65536; /* bound the amount of work we do here */
- for (fd = 3; fd < max_fd; ++fd)
- close (fd);
- }
+ /* Close all other file descriptors. This ensures that we don't
+ * hold open (eg) pipes from the parent process.
+ */
+ max_fd = sysconf (_SC_OPEN_MAX);
+ if (max_fd == -1)
+ max_fd = 1024;
+ if (max_fd > 65536)
+ max_fd = 65536; /* bound the amount of work we do here */
+ for (fd = 3; fd < max_fd; ++fd)
+ close (fd);
/* Set the umask for all subcommands to something sensible (RHBZ#610880). */
umask (022);
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index fb55e026..c7ef3227 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -751,7 +751,6 @@ extern void guestfs_int_cmd_set_stdout_callback (struct command *, cmd_stdout_ca
extern void guestfs_int_cmd_set_stderr_to_stdout (struct command *);
extern void guestfs_int_cmd_set_child_rlimit (struct command *, int resource, long limit);
extern void guestfs_int_cmd_clear_capture_errors (struct command *);
-extern void guestfs_int_cmd_clear_close_files (struct command *);
extern void guestfs_int_cmd_set_child_callback (struct command *, cmd_child_callback child_callback, void *data);
extern int guestfs_int_cmd_run (struct command *);
extern void guestfs_int_cmd_close (struct command *);

View File

@ -1,34 +0,0 @@
From 1eaf876ff2a3bfeaa8756b92e5fa74a91b74f45c Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 14 Jul 2023 15:22:09 +0200
Subject: [PATCH] docs: fix broken link in the guestfs manual
Commit 55202a4d49a1 ("New API: get-sockdir", 2016-02-03) added identical
language to "fish/guestfish.pod" and "src/guestfs.pod", including an
internal link L</get-sockdir>. That's appropriate for
"fish/guestfish.pod", but the same API description is generated with a
different anchor for "src/guestfs.pod". Adapt the reference.
Fixes: 55202a4d49a101392148d79cb2e1591428db2681
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-4-lersek@redhat.com>
(cherry picked from commit b4a4b754c6161b95ddee05e398e0200e6b73b840)
---
lib/guestfs.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index 866a4638..5db6dd91 100644
--- a/lib/guestfs.pod
+++ b/lib/guestfs.pod
@@ -3123,7 +3123,7 @@ non-essential runtime files.
If it is set, then is used to store temporary sockets. Otherwise,
F</tmp> is used.
-See also L</get-sockdir>,
+See also L</guestfs_get_sockdir>,
L<http://www.freedesktop.org/wiki/Specifications/basedir-spec/>.
=back

View File

@ -0,0 +1,91 @@
From 8570de6e766297e4c9feab1c54ae05037f33edeb Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 23 Dec 2021 11:37:01 +0100
Subject: [PATCH] launch-libvirt: add virtio-net via the standard <interface>
element
Starting with version 3.8.0, libvirt allows us to specify the network
address and network mask (as prefix) for SLIRP directly via the
<interface> element in the domain XML:
<https://libvirt.org/formatdomain.html#userspace-slirp-stack>. This means
we don't need the <qemu:commandline> hack for virtio-net on such versions.
Restrict the hack in construct_libvirt_xml_qemu_cmdline() to
libvirt<3.8.0, and generate the proper <interface> element in
construct_libvirt_xml_devices() on libvirt>=3.8.0.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Suggested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-4-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 5858c2cf6c24b3776e3867eafd9d86a1f4912d9c)
---
lib/guestfs-internal.h | 3 ++-
lib/launch-libvirt.c | 27 +++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 97a13ff2c..b11c945e9 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -148,7 +148,8 @@
#endif
/* Place the virtio-net controller in slot 0x1e on the root bus, on normal
- * hardware with PCI. Refer to RHBZ#2034160.
+ * hardware with PCI. Necessary only before libvirt 3.8.0. Refer to
+ * RHBZ#2034160.
*/
#ifdef HAVE_LIBVIRT_BACKEND
#if defined(__arm__) || defined(__s390x__)
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index 0f38f0aec..f6bb39d99 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1396,6 +1396,28 @@ construct_libvirt_xml_devices (guestfs_h *g,
} end_element ();
} end_element ();
+ /* Virtio-net NIC with SLIRP (= userspace) back-end, if networking is
+ * enabled. Starting with libvirt 3.8.0, we can specify the network address
+ * and prefix for SLIRP in the domain XML. Therefore, we can add the NIC
+ * via the standard <interface> element rather than <qemu:commandline>, and
+ * so libvirt can manage the PCI address of the virtio-net NIC like the PCI
+ * addresses of all other devices. Refer to RHBZ#2034160.
+ */
+ if (g->enable_network &&
+ guestfs_int_version_ge (&params->data->libvirt_version, 3, 8, 0)) {
+ start_element ("interface") {
+ attribute ("type", "user");
+ start_element ("model") {
+ attribute ("type", "virtio");
+ } end_element ();
+ start_element ("ip") {
+ attribute ("family", "ipv4");
+ attribute ("address", NETWORK_ADDRESS);
+ attribute ("prefix", NETWORK_PREFIX);
+ } end_element ();
+ } end_element ();
+ }
+
/* Libvirt adds some devices by default. Indicate to libvirt
* that we don't want them.
*/
@@ -1818,9 +1840,10 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
} end_element ();
/* Workaround because libvirt user networking cannot specify "net="
- * parameter.
+ * parameter. Necessary only before libvirt 3.8.0; refer to RHBZ#2034160.
*/
- if (g->enable_network) {
+ if (g->enable_network &&
+ !guestfs_int_version_ge (&params->data->libvirt_version, 3, 8, 0)) {
start_element ("qemu:arg") {
attribute ("value", "-netdev");
} end_element ();
--
2.31.1

View File

@ -0,0 +1,86 @@
From fbb053fc71c0c072acb3fbf6e5fbbfc3b0667fd2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 28 Jan 2021 12:20:49 +0000
Subject: [PATCH] appliance: Use -cpu max.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
QEMU has a newish feature (from about 2017 / qemu 2.9) called -cpu max
which is supposed to select the best CPU, ideal for libguestfs.
After this change, on x86-64:
KVM TCG
Direct -cpu max -cpu max
(non-libvirt)
Libvirt <cpu mode="host-passthrough"> <cpu mode="host-model">
<model fallback="allow"/> <model fallback="allow"/>
</cpu> </cpu>
Thanks: Daniel Berrangé
(cherry picked from commit 30f74f38bd6e42e783ba80895f4d6826abddd417)
---
lib/appliance-cpu.c | 16 ++++++++--------
lib/launch-libvirt.c | 9 +++++++++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/lib/appliance-cpu.c b/lib/appliance-cpu.c
index 5ef9f5c72..54ac6e2e3 100644
--- a/lib/appliance-cpu.c
+++ b/lib/appliance-cpu.c
@@ -38,6 +38,11 @@
*
* The literal string C<"host"> means use C<-cpu host>.
*
+ * =item C<"max">
+ *
+ * The literal string C<"max"> means use C<-cpu max> (the best
+ * possible). This requires awkward translation for libvirt.
+ *
* =item some string
*
* Some string such as C<"cortex-a57"> means use C<-cpu cortex-a57>.
@@ -80,14 +85,9 @@ guestfs_int_get_cpu_model (int kvm)
/* See discussion in https://bugzilla.redhat.com/show_bug.cgi?id=1605071 */
return NULL;
#else
- /* On most architectures, it is faster to pass the CPU host model to
- * the appliance, allowing maximum speed for things like checksums
- * and encryption. Only do this with KVM. It is broken in subtle
- * ways on TCG, and fairly pointless when you're emulating anyway.
+ /* On most architectures we can use "max" to get the best possible CPU.
+ * For recent qemu this should work even on TCG.
*/
- if (kvm)
- return "host";
- else
- return NULL;
+ return "max";
#endif
}
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index f6bb39d99..e3ff1ffe0 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1169,6 +1169,15 @@ construct_libvirt_xml_cpu (guestfs_h *g,
attribute ("fallback", "allow");
} end_element ();
}
+ else if (STREQ (cpu_model, "max")) {
+ if (params->data->is_kvm)
+ attribute ("mode", "host-passthrough");
+ else
+ attribute ("mode", "host-model");
+ start_element ("model") {
+ attribute ("fallback", "allow");
+ } end_element ();
+ }
else
single_element ("model", cpu_model);
} end_element ();
--
2.31.1

View File

@ -1,75 +0,0 @@
From bb3b9ac1ec7021ac04bca03748f15761c6c97487 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 14 Jul 2023 15:22:10 +0200
Subject: [PATCH] docs: clarify sockdir's separation
There's another reason for separating sockdir from tmpdir, beyond "shorter
pathnames needed": permissions. For example, passt drops privileges such
that it cannot access "/tmp", and that restricts both the unix domain
socket and the PID file of passt.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-5-lersek@redhat.com>
(cherry picked from commit 21ccddecf7dd51b24bb2b71dbc8beb1a8dd01923)
---
fish/guestfish.pod | 4 ++--
generator/actions_properties.ml | 8 ++++++--
lib/guestfs.pod | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index d36cac9d..33fc8b2c 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -1492,8 +1492,8 @@ See L</LIBGUESTFS_CACHEDIR>, L</LIBGUESTFS_TMPDIR>.
This directory represents a user-specific directory for storing
non-essential runtime files.
-If it is set, then is used to store temporary sockets. Otherwise,
-F</tmp> is used.
+If it is set, then is used to store temporary sockets and PID files.
+Otherwise, F</tmp> is used.
See also L</get-sockdir>,
L<http://www.freedesktop.org/wiki/Specifications/basedir-spec/>.
diff --git a/generator/actions_properties.ml b/generator/actions_properties.ml
index f84afb10..42eaaa4d 100644
--- a/generator/actions_properties.ml
+++ b/generator/actions_properties.ml
@@ -595,13 +595,17 @@ Get the handle identifier. See C<guestfs_set_identifier>." };
name = "get_sockdir"; added = (1, 33, 8);
style = RString (RPlainString, "sockdir"), [], [];
blocking = false;
- shortdesc = "get the temporary directory for sockets";
+ shortdesc = "get the temporary directory for sockets and PID files";
longdesc = "\
-Get the directory used by the handle to store temporary socket files.
+Get the directory used by the handle to store temporary socket and PID
+files.
This is different from C<guestfs_get_tmpdir>, as we need shorter
paths for sockets (due to the limited buffers of filenames for UNIX
sockets), and C<guestfs_get_tmpdir> may be too long for them.
+Furthermore, sockets and PID files must be accessible to such background
+services started by libguestfs that may not have permission to access
+the temporary directory returned by C<guestfs_get_tmpdir>.
The environment variable C<XDG_RUNTIME_DIR> controls the default
value: If C<XDG_RUNTIME_DIR> is set, then that is the default.
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index 5db6dd91..dff32cc9 100644
--- a/lib/guestfs.pod
+++ b/lib/guestfs.pod
@@ -3120,8 +3120,8 @@ See L</LIBGUESTFS_CACHEDIR>, L</LIBGUESTFS_TMPDIR>.
This directory represents a user-specific directory for storing
non-essential runtime files.
-If it is set, then is used to store temporary sockets. Otherwise,
-F</tmp> is used.
+If it is set, then is used to store temporary sockets and PID files.
+Otherwise, F</tmp> is used.
See also L</guestfs_get_sockdir>,
L<http://www.freedesktop.org/wiki/Specifications/basedir-spec/>.

View File

@ -0,0 +1,48 @@
From 7dde1007525ec235e769351be15ca5de34eeda4a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Mar 2021 12:32:26 +0000
Subject: [PATCH] appliance: Use <cpu mode="maximum"/> for -cpu max on libvirt.
Note this requires libvirt >= 7.1.0 which was only released in March 2021.
With an older libvirt you will see this error:
Original error from libvirt: unsupported configuration: Invalid mode attribute 'maximum' [code=67 int1=-1]
In theory we could check if this is supported by looking at the
libvirt capabilities and fall back, but this commit does not do that,
in the expectation that most people will be using the default backend
(direct) and on Fedora/RHEL we will add an explicit minimum version
dependency to the package.
qemu support has been around quite a bit longer (at least since 2017).
Fixes: commit 30f74f38bd6e42e783ba80895f4d6826abddd417
(cherry picked from commit 13ceb6a87b2869909a6a0e3c8caa962b72e4cb0e)
---
lib/launch-libvirt.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index e3ff1ffe0..db619910f 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1170,13 +1170,8 @@ construct_libvirt_xml_cpu (guestfs_h *g,
} end_element ();
}
else if (STREQ (cpu_model, "max")) {
- if (params->data->is_kvm)
- attribute ("mode", "host-passthrough");
- else
- attribute ("mode", "host-model");
- start_element ("model") {
- attribute ("fallback", "allow");
- } end_element ();
+ /* https://bugzilla.redhat.com/show_bug.cgi?id=1935572#c11 */
+ attribute ("mode", "maximum");
}
else
single_element ("model", cpu_model);
--
2.31.1

View File

@ -1,144 +0,0 @@
From 8ba3628594c354dafcc715a842199c75a5676b57 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 14 Jul 2023 15:22:11 +0200
Subject: [PATCH] lib: move guestfs_int_create_socketname() from "launch.c" to
"tmpdirs.c"
Consider the following inverted call tree (effectively a dependency tree
-- callees are at the top and near the left margin):
lazy_make_tmpdir() [lib/tmpdirs.c]
guestfs_int_lazy_make_tmpdir() [lib/tmpdirs.c]
guestfs_int_make_temp_path() [lib/tmpdirs.c]
guestfs_int_lazy_make_sockdir() [lib/tmpdirs.c]
guestfs_int_create_socketname() [lib/launch.c]
lazy_make_tmpdir() is our common workhorse / helper function that
centralizes the mkdtemp() function call.
guestfs_int_lazy_make_tmpdir() and guestfs_int_lazy_make_sockdir() are the
next level functions, both calling lazy_make_tmpdir(), just feeding it
different dirname generator functions, and different "is_runtime_dir"
qualifications. These functions create temp dirs for various, more
specific, purposes (see the manual and "lib/guestfs-internal.h" for more
details).
On a yet higher level are guestfs_int_make_temp_path() and
guestfs_int_create_socketname() -- they serve for creating *entries* in
those specific temp directories.
The discrepancy here is that, although all the other functions live in
"lib/tmpdirs.c", guestfs_int_create_socketname() is defined in
"lib/launch.c". That makes for a confusing code reading; move the function
to "lib/tmpdirs.c", just below its sibling function
guestfs_int_make_temp_path().
While at it, correct the leading comment on
guestfs_int_create_socketname() -- the socket pathname is created in the
socket directory, not in the temporary directory.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-6-lersek@redhat.com>
(cherry picked from commit 0b2ad40a098cbaf91d0d0a2df6e31bf8e3e08ace)
---
lib/guestfs-internal.h | 2 +-
lib/launch.c | 26 --------------------------
lib/tmpdirs.c | 26 ++++++++++++++++++++++++++
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index c7ef3227..ebd68380 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -668,6 +668,7 @@ extern int guestfs_int_set_env_runtimedir (guestfs_h *g, const char *envname, co
extern int guestfs_int_lazy_make_tmpdir (guestfs_h *g);
extern int guestfs_int_lazy_make_sockdir (guestfs_h *g);
extern char *guestfs_int_make_temp_path (guestfs_h *g, const char *name, const char *extension);
+extern int guestfs_int_create_socketname (guestfs_h *g, const char *filename, char (*sockname)[UNIX_PATH_MAX]);
extern char *guestfs_int_lazy_make_supermin_appliance_dir (guestfs_h *g);
extern void guestfs_int_remove_tmpdir (guestfs_h *g);
extern void guestfs_int_remove_sockdir (guestfs_h *g);
@@ -700,7 +701,6 @@ extern int guestfs_int_get_uefi (guestfs_h *g, char *const *firmwares, const cha
extern int64_t guestfs_int_timeval_diff (const struct timeval *x, const struct timeval *y);
extern void guestfs_int_launch_send_progress (guestfs_h *g, int perdozen);
extern void guestfs_int_unblock_sigterm (void);
-extern int guestfs_int_create_socketname (guestfs_h *g, const char *filename, char (*sockname)[UNIX_PATH_MAX]);
extern void guestfs_int_register_backend (const char *name, const struct backend_ops *);
extern int guestfs_int_set_backend (guestfs_h *g, const char *method);
diff --git a/lib/launch.c b/lib/launch.c
index 6e08b120..bd0526c9 100644
--- a/lib/launch.c
+++ b/lib/launch.c
@@ -309,32 +309,6 @@ guestfs_impl_config (guestfs_h *g,
return 0;
}
-/**
- * Create the path for a socket with the selected filename in the
- * tmpdir.
- */
-int
-guestfs_int_create_socketname (guestfs_h *g, const char *filename,
- char (*sockpath)[UNIX_PATH_MAX])
-{
- int r;
-
- if (guestfs_int_lazy_make_sockdir (g) == -1)
- return -1;
-
- r = snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", g->sockdir, filename);
- if (r >= UNIX_PATH_MAX) {
- error (g, _("socket path too long: %s/%s"), g->sockdir, filename);
- return -1;
- }
- if (r < 0) {
- perrorf (g, _("%s"), g->sockdir);
- return -1;
- }
-
- return 0;
-}
-
/**
* When the library is loaded, each backend calls this function to
* register itself in a global list.
diff --git a/lib/tmpdirs.c b/lib/tmpdirs.c
index b8e19de2..24adf98d 100644
--- a/lib/tmpdirs.c
+++ b/lib/tmpdirs.c
@@ -253,6 +253,32 @@ guestfs_int_make_temp_path (guestfs_h *g,
extension ? extension : "");
}
+/**
+ * Create the path for a socket with the selected filename in the
+ * sockdir.
+ */
+int
+guestfs_int_create_socketname (guestfs_h *g, const char *filename,
+ char (*sockpath)[UNIX_PATH_MAX])
+{
+ int r;
+
+ if (guestfs_int_lazy_make_sockdir (g) == -1)
+ return -1;
+
+ r = snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", g->sockdir, filename);
+ if (r >= UNIX_PATH_MAX) {
+ error (g, _("socket path too long: %s/%s"), g->sockdir, filename);
+ return -1;
+ }
+ if (r < 0) {
+ perrorf (g, _("%s"), g->sockdir);
+ return -1;
+ }
+
+ return 0;
+}
+
/**
* Create the supermin appliance directory under cachedir, if it does
* not exist.

View File

@ -1,241 +0,0 @@
From e7501a32cb096c1957aae0de934c0b563ff18a5f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 15 Jul 2023 16:33:18 +0100
Subject: [PATCH] generator: customize: Add new StringTriplet for use by
--chown
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The just added --chown option previously used StringPair, splitting
the argument as UID.GID:FILENAME. However this will not work if we
ever extend this with the ability to use user or group names, since
they may contain dot (but not colon). Add a new StringTriplet type
and split the argument string three ways. The new option becomes:
virt-customize ... --chown UID:GID:FILENAME
Include the following commit from the common submodule:
commit e70d89a58dae068be2e19c7c21558707261af96a
Author: Richard W.M. Jones <rjones@redhat.com>
Date: Sat Jul 15 16:42:06 2023 +0100
customize: Update generated files for --chown with StringTriplet
Updates: commit d8e48bff212f9b0558480ffedf8158157360d0d5
(cherry picked from commit c08032ebe2763f5e9ce5b14e003721475219d390)
---
common | 2 +-
generator/customize.ml | 44 ++++++++++++++++++++++++++++++++----------
2 files changed, 35 insertions(+), 11 deletions(-)
Submodule common bbb54714..e70d89a5:
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index 22724600..e658a447 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -63,7 +63,7 @@ Change the permissions of C<FILE> to C<PERMISSIONS>.
I<Note>: C<PERMISSIONS> by default would be decimal, unless you prefix
it with C<0> to get octal, ie. use C<0700> not C<700>.
-=item B<--chown> UID.GID:PATH
+=item B<--chown> UID:GID:PATH
Change the owner user and group ID of a file or directory in the guest.
Note:
@@ -83,7 +83,7 @@ This will not work with Windows guests.
For example:
- virt-customize --chown '0.0:/var/log/audit.log'
+ virt-customize --chown '0:0:/var/log/audit.log'
See also: I<--upload>.
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index e20b12d4..5031b015 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -1,5 +1,5 @@
[--append-line FILE:LINE] [--chmod PERMISSIONS:FILE]
- [--chown UID.GID:PATH] [--commands-from-file FILENAME]
+ [--chown UID:GID:PATH] [--commands-from-file FILENAME]
[--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR]
[--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT]
[--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index fd3074ad..3ce901db 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -41,8 +41,8 @@ and op = [
(* --append-line FILE:LINE *)
| `Chmod of string * string
(* --chmod PERMISSIONS:FILE *)
- | `Chown of string * string
- (* --chown UID.GID:PATH *)
+ | `Chown of string * string * string
+ (* --chown UID:GID:PATH *)
| `CommandsFromFile of string
(* --commands-from-file FILENAME *)
| `Copy of string * string
@@ -154,8 +154,13 @@ let rec argspec () =
option_name in
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
- in
- let split_string_list arg =
+ and split_string_triplet option_name arg =
+ match String.nsplit ~max:3 "," arg with
+ | [a; b; c] -> a, b, c
+ | _ ->
+ error (f_"invalid format for '--%s' parameter, see the man page")
+ option_name
+ and split_string_list arg =
String.nsplit "," arg
in
let split_links_list option_name arg =
@@ -192,14 +197,14 @@ let rec argspec () =
(
[ L"chown" ],
Getopt.String (
- s_"UID.GID:PATH",
+ s_"UID:GID:PATH",
fun s ->
- let p = split_string_pair "chown" s in
+ let p = split_string_triplet "chown" s in
List.push_front (`Chown p) ops
),
s_"Change the owner user and group ID of a file or directory"
),
- Some "UID.GID:PATH", "Change the owner user and group ID of a file or directory in the guest.\nNote:\n\n=over 4\n\n=item *\n\nOnly numeric UIDs and GIDs will work, and these may not be the same\ninside the guest as on the host.\n\n=item *\n\nThis will not work with Windows guests.\n\n=back\n\nFor example:\n\n virt-customize --chown '0.0:/var/log/audit.log'\n\nSee also: I<--upload>.";
+ Some "UID:GID:PATH", "Change the owner user and group ID of a file or directory in the guest.\nNote:\n\n=over 4\n\n=item *\n\nOnly numeric UIDs and GIDs will work, and these may not be the same\ninside the guest as on the host.\n\n=item *\n\nThis will not work with Windows guests.\n\n=back\n\nFor example:\n\n virt-customize --chown '0:0:/var/log/audit.log'\n\nSee also: I<--upload>.";
(
[ L"commands-from-file" ],
Getopt.String (
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index 5883bbe0..112b74dc 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -33,8 +33,8 @@ and op = [
(* --append-line FILE:LINE *)
| `Chmod of string * string
(* --chmod PERMISSIONS:FILE *)
- | `Chown of string * string
- (* --chown UID.GID:PATH *)
+ | `Chown of string * string * string
+ (* --chown UID:GID:PATH *)
| `CommandsFromFile of string
(* --commands-from-file FILENAME *)
| `Copy of string * string
diff --git a/generator/customize.ml b/generator/customize.ml
index 8d3dec3e..fe87ef5e 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -41,6 +41,7 @@ and op_type =
| Unit (* no argument *)
| String of string (* string *)
| StringPair of string (* string:string *)
+| StringTriplet of string (* string:string:string *)
| StringList of string (* string,string,... *)
| TargetLinks of string (* target:link[:link...] *)
| PasswordSelector of string (* password selector *)
@@ -96,7 +97,7 @@ it with C<0> to get octal, ie. use C<0700> not C<700>.";
};
{ op_name = "chown";
- op_type = StringPair "UID.GID:PATH";
+ op_type = StringTriplet "UID:GID:PATH";
op_discrim = "`Chown";
op_shortdesc = "Change the owner user and group ID of a file or directory";
op_pod_longdesc = "\
@@ -118,7 +119,7 @@ This will not work with Windows guests.
For example:
- virt-customize --chown '0.0:/var/log/audit.log'
+ virt-customize --chown '0:0:/var/log/audit.log'
See also: I<--upload>.";
};
@@ -761,8 +762,13 @@ let rec argspec () =
option_name in
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
- in
- let split_string_list arg =
+ and split_string_triplet option_name arg =
+ match String.nsplit ~max:3 \",\" arg with
+ | [a; b; c] -> a, b, c
+ | _ ->
+ error (f_\"invalid format for '--%%s' parameter, see the man page\")
+ option_name
+ and split_string_list arg =
String.nsplit \",\" arg
in
let split_links_list option_name arg =
@@ -807,6 +813,19 @@ let rec argspec () =
pr " s_\"%s\"\n" shortdesc;
pr " ),\n";
pr " Some %S, %S;\n" v longdesc
+ | { op_type = StringTriplet v; op_name = name; op_discrim = discrim;
+ op_shortdesc = shortdesc; op_pod_longdesc = longdesc } ->
+ pr " (\n";
+ pr " [ L\"%s\" ],\n" name;
+ pr " Getopt.String (\n";
+ pr " s_\"%s\",\n" v;
+ pr " fun s ->\n";
+ pr " let p = split_string_triplet \"%s\" s in\n" name;
+ pr " List.push_front (%s p) ops\n" discrim;
+ pr " ),\n";
+ pr " s_\"%s\"\n" shortdesc;
+ pr " ),\n";
+ pr " Some %S, %S;\n" v longdesc
| { op_type = StringList v; op_name = name; op_discrim = discrim;
op_shortdesc = shortdesc; op_pod_longdesc = longdesc } ->
pr " (\n";
@@ -956,6 +975,7 @@ let rec argspec () =
| { op_type = Unit; }
| { op_type = String _; }
| { op_type = StringPair _; }
+ | { op_type = StringTriplet _; }
| { op_type = StringList _; }
| { op_type = TargetLinks _; }
| { op_type = PasswordSelector _; }
@@ -1021,6 +1041,10 @@ type ops = {
| { op_type = StringPair v; op_discrim = discrim;
op_name = name } ->
pr " | %s of string * string\n (* --%s %s *)\n" discrim name v
+ | { op_type = StringTriplet v; op_discrim = discrim;
+ op_name = name } ->
+ pr " | %s of string * string * string\n (* --%s %s *)\n"
+ discrim name v
| { op_type = StringList v; op_discrim = discrim;
op_name = name } ->
pr " | %s of string list\n (* --%s %s *)\n" discrim name v
@@ -1073,9 +1097,9 @@ let generate_customize_synopsis_pod () =
function
| { op_type = Unit; op_name = n } ->
n, sprintf "[--%s]" n
- | { op_type = String v | StringPair v | StringList v | TargetLinks v
- | PasswordSelector v | UserPasswordSelector v | SSHKeySelector v
- | StringFn (v, _) | SMPoolSelector v;
+ | { op_type = String v | StringPair v | StringTriplet v | StringList v
+ | TargetLinks v | PasswordSelector v | UserPasswordSelector v
+ | SSHKeySelector v | StringFn (v, _) | SMPoolSelector v;
op_name = n } ->
n, sprintf "[--%s %s]" n v
) ops @
@@ -1116,9 +1140,9 @@ let generate_customize_options_pod () =
function
| { op_type = Unit; op_name = n; op_pod_longdesc = ld } ->
n, sprintf "B<--%s>" n, ld
- | { op_type = String v | StringPair v | StringList v | TargetLinks v
- | PasswordSelector v | UserPasswordSelector v | SSHKeySelector v
- | StringFn (v, _) | SMPoolSelector v;
+ | { op_type = String v | StringPair v | StringTriplet v | StringList v
+ | TargetLinks v | PasswordSelector v | UserPasswordSelector v
+ | SSHKeySelector v | StringFn (v, _) | SMPoolSelector v;
op_name = n; op_pod_longdesc = ld } ->
n, sprintf "B<--%s> %s" n v, ld
) ops @

View File

@ -0,0 +1,92 @@
From bb19cc0cdd43619ccf830e1e608f79e46f8ddf86 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 12 May 2022 08:36:37 +0100
Subject: [PATCH] lib: Disable 5-level page tables when using -cpu max
In https://bugzilla.redhat.com/show_bug.cgi?id=2082806 we've been
tracking an insidious qemu bug which intermittently prevents the
libguestfs appliance from starting. The symptoms are that SeaBIOS
starts and displays its messages, but the kernel isn't reached. We
found that the kernel does in fact start, but when it tries to set up
page tables and jump to protected mode it gets a triple fault which
causes the emulated CPU in qemu to reset (qemu exits).
This seems to only affect TCG (not KVM).
Yesterday I found that this is caused by using -cpu max which enables
the "la57" feature (5-level page tables[0]), and that we can make the
problem go away using -cpu max,la57=off. Note that I still don't
fully understand the qemu bug, so this is only a workaround.
I chose to disable 5-level page tables for both TCG and KVM, partly to
make the patch simpler, and partly because I guess it's not a feature
(ie. 57 bit linear addresses) that is useful for the libguestfs
appliance case, where we have limited physical memory and no need to
run any programs with huge address spaces.
I tested this by running both the direct & libvirt paths overnight. I
expect that this patch will fail with old qemu/libvirt which doesn't
understand the "la57" feature, but this is only intended as a
temporary workaround.
[0] Article about 5-level page tables as background:
https://lwn.net/Articles/717293/
Thanks: Laszlo Ersek
Fixes: https://answers.launchpad.net/ubuntu/+source/libguestfs/+question/701625
[RHEL 8.7: Patch is not upstream. This is the initial patch as posted
to the mailing list here:
https://listman.redhat.com/archives/libguestfs/2022-May/028853.html]
---
lib/launch-direct.c | 15 +++++++++++++--
lib/launch-libvirt.c | 7 +++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index de17d2167..6b28e4724 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -534,8 +534,19 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
} end_list ();
cpu_model = guestfs_int_get_cpu_model (has_kvm && !force_tcg);
- if (cpu_model)
- arg ("-cpu", cpu_model);
+ if (cpu_model) {
+#if defined(__x86_64__)
+ /* Temporary workaround for RHBZ#2082806 */
+ if (STREQ (cpu_model, "max")) {
+ start_list ("-cpu") {
+ append_list (cpu_model);
+ append_list ("la57=off");
+ } end_list ();
+ }
+ else
+#endif
+ arg ("-cpu", cpu_model);
+ }
if (g->smp > 1)
arg_format ("-smp", "%d", g->smp);
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index db619910f..bad4a54ea 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1172,6 +1172,13 @@ construct_libvirt_xml_cpu (guestfs_h *g,
else if (STREQ (cpu_model, "max")) {
/* https://bugzilla.redhat.com/show_bug.cgi?id=1935572#c11 */
attribute ("mode", "maximum");
+#if defined(__x86_64__)
+ /* Temporary workaround for RHBZ#2082806 */
+ start_element ("feature") {
+ attribute ("policy", "disable");
+ attribute ("name", "la57");
+ } end_element ();
+#endif
}
else
single_element ("model", cpu_model);
--
2.31.1

View File

@ -1,57 +0,0 @@
From 981b48085a2d0e422578bc12d6c3b68e312bad44 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 20 Jul 2023 11:15:26 +0100
Subject: [PATCH] daemon: lvm: Do reverse device name translation on pvs_full
device fields
Intermittent test failures in virt-filesystems showed that when using
the pvs_full API, the pv_name field in the returned list of structures
was not being reverse translated. As a result internal partition
names could appear in the output of virt-filesystems.
See: https://listman.redhat.com/archives/libguestfs/2023-July/032058.html
(cherry picked from commit 32cb5b45cfbe5edbc7643fc533da70db2d3c6cda)
---
daemon/lvm.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/daemon/lvm.c b/daemon/lvm.c
index 7e76e17c..b8c01f71 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -146,7 +146,34 @@ do_vgs (void)
guestfs_int_lvm_pv_list *
do_pvs_full (void)
{
- return parse_command_line_pvs ();
+ guestfs_int_lvm_pv_list *r;
+ size_t i;
+ char *din, *dout;
+
+ r = parse_command_line_pvs ();
+ if (r == NULL)
+ /* parse_command_line_pvs has already called reply_with_error */
+ return NULL;
+
+ /* The pv_name fields contain device names which must be reverse
+ * translated. The problem here is that the generator does not have
+ * a "FMountable" field type in types.mli.
+ */
+ for (i = 0; i < r->guestfs_int_lvm_pv_list_len; ++i) {
+ din = r->guestfs_int_lvm_pv_list_val[i].pv_name;
+ if (din) {
+ dout = reverse_device_name_translation (din);
+ if (!dout) {
+ /* reverse_device_name_translation has already called reply_with_error*/
+ /* XXX memory leak here */
+ return NULL;
+ }
+ r->guestfs_int_lvm_pv_list_val[i].pv_name = dout;
+ free (din);
+ }
+ }
+
+ return r;
}
guestfs_int_lvm_vg_list *

View File

@ -0,0 +1,103 @@
From 22d779d5982dc82d629710d41973ed6545707bd9 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 28 Jun 2022 13:54:16 +0200
Subject: [PATCH] docs/guestfs-security: document CVE-2022-2211
Short log for the common submodule, commit range
f8de5508fe75..35467027f657:
Laszlo Ersek (2):
mlcustomize: factor out pkg install/update/uninstall from guestfs-tools
options: fix buffer overflow in get_keys() [CVE-2022-2211]
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2100862
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220628115418.5376-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Cherry picked from commit 99844660b48ed809e37378262c65d63df6ce4a53.
For the cherry pick I only added one submodule commit:
options: fix buffer overflow in get_keys() [CVE-2022-2211]
---
common | 2 +-
docs/guestfs-security.pod | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
Submodule common be09523d6..1174b443a:
diff --git a/common/options/keys.c b/common/options/keys.c
index 798315c..d27a712 100644
--- a/common/options/keys.c
+++ b/common/options/keys.c
@@ -128,17 +128,23 @@ read_first_line_from_file (const char *filename)
char **
get_keys (struct key_store *ks, const char *device, const char *uuid)
{
- size_t i, j, len;
+ size_t i, j, nmemb;
char **r;
char *s;
/* We know the returned list must have at least one element and not
* more than ks->nr_keys.
*/
- len = 1;
- if (ks)
- len = MIN (1, ks->nr_keys);
- r = calloc (len+1, sizeof (char *));
+ nmemb = 1;
+ if (ks && ks->nr_keys > nmemb)
+ nmemb = ks->nr_keys;
+
+ /* make room for the terminating NULL */
+ if (nmemb == (size_t)-1)
+ error (EXIT_FAILURE, 0, _("size_t overflow"));
+ nmemb++;
+
+ r = calloc (nmemb, sizeof (char *));
if (r == NULL)
error (EXIT_FAILURE, errno, "calloc");
diff --git a/docs/guestfs-security.pod b/docs/guestfs-security.pod
index 9ceef5623..efa35b29d 100644
--- a/docs/guestfs-security.pod
+++ b/docs/guestfs-security.pod
@@ -406,6 +406,34 @@ The libvirt backend is not affected.
The solution is to update qemu to a version containing the fix (see
L<https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg01012.html>).
+=head2 CVE-2022-2211
+
+L<https://bugzilla.redhat.com/CVE-2022-2211>
+
+The C<get_keys> function in F<libguestfs-common/options/keys.c> collects
+those I<--key> options from the command line into a new array that match
+a particular block device that's being decrypted for inspection. The
+function intends to size the result array such that potentially all
+I<--key> options, plus a terminating C<NULL> element, fit into it. The
+code mistakenly uses the C<MIN> macro instead of C<MAX>, and therefore
+only one element is allocated before the C<NULL> terminator.
+
+Passing precisely two I<--key ID:...> options on the command line for
+the encrypted block device C<ID> causes C<get_keys> to overwrite the
+terminating C<NULL>, leading to an out-of-bounds read in
+C<decrypt_mountables>, file F<libguestfs-common/options/decrypt.c>.
+
+Passing more than two I<--key ID:...> options on the command line for
+the encrypted block device C<ID> causes C<get_keys> itself to perform
+out-of-bounds writes. The most common symptom is a crash with C<SIGSEGV>
+later on.
+
+This issue affects -- broadly speaking -- all libguestfs-based utilities
+that accept I<--key>, namely: C<guestfish>, C<guestmount>, C<virt-cat>,
+C<virt-customize>, C<virt-diff>, C<virt-edit>, C<virt-get-kernel>,
+C<virt-inspector>, C<virt-log>, C<virt-ls>, C<virt-sparsify>,
+C<virt-sysprep>, C<virt-tail>, C<virt-v2v>.
+
=head1 SEE ALSO
L<guestfs(3)>,
--
2.31.1

View File

@ -1,208 +0,0 @@
From 12873e21070ba3d0aca45b626f4df00adb14aad5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 21 Sep 2023 15:16:51 +0100
Subject: [PATCH] ruby: Replace MiniTest with Minitest
See this commit in hivex:
https://github.com/libguestfs/hivex/commit/fbcff7fbd8f96214c7f13f36bd7669a9142824ab
(cherry picked from commit d25a48e2dd2c2a2063b8d03a33b5e3cbe773c47d)
---
ruby/t/tc_010_load.rb | 2 +-
ruby/t/tc_020_create.rb | 2 +-
ruby/t/tc_030_create_flags.rb | 2 +-
ruby/t/tc_040_create_multiple.rb | 2 +-
ruby/t/tc_050_handle_properties.rb | 2 +-
ruby/t/tc_060_explicit_close.rb | 2 +-
ruby/t/tc_070_optargs.rb | 2 +-
ruby/t/tc_090_retvalues.rb | 2 +-
ruby/t/tc_100_launch.rb | 2 +-
ruby/t/tc_410_close_event.rb | 2 +-
ruby/t/tc_420_log_messages.rb | 2 +-
ruby/t/tc_800_rhbz507346.rb | 2 +-
ruby/t/tc_810_rhbz664558c6.rb | 2 +-
ruby/t/tc_820_rhbz1046509.rb | 2 +-
14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/ruby/t/tc_010_load.rb b/ruby/t/tc_010_load.rb
index 9dc2db67..40ddccd8 100644
--- a/ruby/t/tc_010_load.rb
+++ b/ruby/t/tc_010_load.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test010Load < MiniTest::Unit::TestCase
+class Test010Load < Minitest::Test
def test_010_load
end
end
diff --git a/ruby/t/tc_020_create.rb b/ruby/t/tc_020_create.rb
index 840dd858..c3f5307e 100644
--- a/ruby/t/tc_020_create.rb
+++ b/ruby/t/tc_020_create.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test020Create < MiniTest::Unit::TestCase
+class Test020Create < Minitest::Test
def test_020_create
g = Guestfs::Guestfs.new()
refute_nil (g)
diff --git a/ruby/t/tc_030_create_flags.rb b/ruby/t/tc_030_create_flags.rb
index ac6d1f46..4949d2a8 100644
--- a/ruby/t/tc_030_create_flags.rb
+++ b/ruby/t/tc_030_create_flags.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test030CreateFlags < MiniTest::Unit::TestCase
+class Test030CreateFlags < Minitest::Test
def test_030_create_flags
g = Guestfs::Guestfs.new(:environment => false, :close_on_exit => true)
refute_nil (g)
diff --git a/ruby/t/tc_040_create_multiple.rb b/ruby/t/tc_040_create_multiple.rb
index 36e8edc7..623ccc6e 100644
--- a/ruby/t/tc_040_create_multiple.rb
+++ b/ruby/t/tc_040_create_multiple.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test040CreateMultiple < MiniTest::Unit::TestCase
+class Test040CreateMultiple < Minitest::Test
def test_040_create_multiple
g1 = Guestfs::Guestfs.new()
g2 = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_050_handle_properties.rb b/ruby/t/tc_050_handle_properties.rb
index 5928532e..b22c51fd 100644
--- a/ruby/t/tc_050_handle_properties.rb
+++ b/ruby/t/tc_050_handle_properties.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test050HandleProperties < MiniTest::Unit::TestCase
+class Test050HandleProperties < Minitest::Test
def test_050_handle_properties
g = Guestfs::Guestfs.new()
refute_nil (g)
diff --git a/ruby/t/tc_060_explicit_close.rb b/ruby/t/tc_060_explicit_close.rb
index 0c9118aa..20afd0de 100644
--- a/ruby/t/tc_060_explicit_close.rb
+++ b/ruby/t/tc_060_explicit_close.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test060ExplicitClose < MiniTest::Unit::TestCase
+class Test060ExplicitClose < Minitest::Test
def test_060_explicit_close
g = Guestfs::Guestfs.new()
refute_nil (g)
diff --git a/ruby/t/tc_070_optargs.rb b/ruby/t/tc_070_optargs.rb
index fff5fbf7..a2360b2f 100644
--- a/ruby/t/tc_070_optargs.rb
+++ b/ruby/t/tc_070_optargs.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test070Optargs < MiniTest::Unit::TestCase
+class Test070Optargs < Minitest::Test
def test_070_optargs
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_090_retvalues.rb b/ruby/t/tc_090_retvalues.rb
index 4bcc8b54..c9a84276 100644
--- a/ruby/t/tc_090_retvalues.rb
+++ b/ruby/t/tc_090_retvalues.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test090RetValues < MiniTest::Unit::TestCase
+class Test090RetValues < Minitest::Test
def test_090_retvalues
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_100_launch.rb b/ruby/t/tc_100_launch.rb
index 43db4b67..096cbd62 100644
--- a/ruby/t/tc_100_launch.rb
+++ b/ruby/t/tc_100_launch.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test100Launch < MiniTest::Unit::TestCase
+class Test100Launch < Minitest::Test
def test_100_launch
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_410_close_event.rb b/ruby/t/tc_410_close_event.rb
index 1b98957e..9a4e0558 100644
--- a/ruby/t/tc_410_close_event.rb
+++ b/ruby/t/tc_410_close_event.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test410CloseEvent < MiniTest::Unit::TestCase
+class Test410CloseEvent < Minitest::Test
def test_410_close_event
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_420_log_messages.rb b/ruby/t/tc_420_log_messages.rb
index 936e0fd4..a113c62e 100644
--- a/ruby/t/tc_420_log_messages.rb
+++ b/ruby/t/tc_420_log_messages.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test420LogMessages < MiniTest::Unit::TestCase
+class Test420LogMessages < Minitest::Test
def test_420_log_messages
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_800_rhbz507346.rb b/ruby/t/tc_800_rhbz507346.rb
index 4b7cc010..06767352 100644
--- a/ruby/t/tc_800_rhbz507346.rb
+++ b/ruby/t/tc_800_rhbz507346.rb
@@ -17,7 +17,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test800RHBZ507346 < MiniTest::Unit::TestCase
+class Test800RHBZ507346 < Minitest::Test
def test_800_rhbz507346
g = Guestfs::Guestfs.new()
exception = assert_raises TypeError do
diff --git a/ruby/t/tc_810_rhbz664558c6.rb b/ruby/t/tc_810_rhbz664558c6.rb
index f5e9adee..1504c070 100644
--- a/ruby/t/tc_810_rhbz664558c6.rb
+++ b/ruby/t/tc_810_rhbz664558c6.rb
@@ -21,7 +21,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test810RHBZ664558C6 < MiniTest::Unit::TestCase
+class Test810RHBZ664558C6 < Minitest::Test
def test_810_rhbz_664558c6
g = Guestfs::Guestfs.new()
diff --git a/ruby/t/tc_820_rhbz1046509.rb b/ruby/t/tc_820_rhbz1046509.rb
index 882ddb55..0595293d 100644
--- a/ruby/t/tc_820_rhbz1046509.rb
+++ b/ruby/t/tc_820_rhbz1046509.rb
@@ -20,7 +20,7 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class Test820RHBZ1046509 < MiniTest::Unit::TestCase
+class Test820RHBZ1046509 < Minitest::Test
def _handleok(g)
g.add_drive("/dev/null")
g.close()

View File

@ -1,278 +0,0 @@
From fbe7e96cee460e26a0ff6a9c293c155a78bfdfde Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 21 Sep 2023 15:20:55 +0100
Subject: [PATCH] ruby: Get rid of old Test::Unit compatibility
See this commit in hivex:
https://github.com/libguestfs/hivex/commit/6dbbc474d3df5cdfd21ed5e692b3a58136fffc42
(cherry picked from commit ecf361d7237d38b2418ddecb1b70e3b722509c12)
---
ruby/Makefile.am | 3 +--
ruby/t/tc_010_load.rb | 3 ++-
ruby/t/tc_020_create.rb | 3 ++-
ruby/t/tc_030_create_flags.rb | 3 ++-
ruby/t/tc_040_create_multiple.rb | 3 ++-
ruby/t/tc_050_handle_properties.rb | 3 ++-
ruby/t/tc_060_explicit_close.rb | 3 ++-
ruby/t/tc_070_optargs.rb | 3 ++-
ruby/t/tc_090_retvalues.rb | 3 ++-
ruby/t/tc_100_launch.rb | 3 ++-
ruby/t/tc_410_close_event.rb | 3 ++-
ruby/t/tc_420_log_messages.rb | 3 ++-
ruby/t/tc_800_rhbz507346.rb | 3 ++-
ruby/t/tc_810_rhbz664558c6.rb | 3 ++-
ruby/t/tc_820_rhbz1046509.rb | 3 ++-
ruby/t/test_helper.rb | 33 ------------------------------
16 files changed, 29 insertions(+), 49 deletions(-)
delete mode 100644 ruby/t/test_helper.rb
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index c26513a7..867b05b1 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -40,8 +40,7 @@ EXTRA_DIST = \
lib/guestfs.rb \
run-bindtests \
run-ruby-tests \
- t/tc_*.rb \
- t/test_helper.rb
+ t/tc_*.rb
CLEANFILES += \
lib/*~ \
diff --git a/ruby/t/tc_010_load.rb b/ruby/t/tc_010_load.rb
index 40ddccd8..e7ec482e 100644
--- a/ruby/t/tc_010_load.rb
+++ b/ruby/t/tc_010_load.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test010Load < Minitest::Test
def test_010_load
diff --git a/ruby/t/tc_020_create.rb b/ruby/t/tc_020_create.rb
index c3f5307e..26bb2ecf 100644
--- a/ruby/t/tc_020_create.rb
+++ b/ruby/t/tc_020_create.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test020Create < Minitest::Test
def test_020_create
diff --git a/ruby/t/tc_030_create_flags.rb b/ruby/t/tc_030_create_flags.rb
index 4949d2a8..8006d962 100644
--- a/ruby/t/tc_030_create_flags.rb
+++ b/ruby/t/tc_030_create_flags.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test030CreateFlags < Minitest::Test
def test_030_create_flags
diff --git a/ruby/t/tc_040_create_multiple.rb b/ruby/t/tc_040_create_multiple.rb
index 623ccc6e..32b2b094 100644
--- a/ruby/t/tc_040_create_multiple.rb
+++ b/ruby/t/tc_040_create_multiple.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test040CreateMultiple < Minitest::Test
def test_040_create_multiple
diff --git a/ruby/t/tc_050_handle_properties.rb b/ruby/t/tc_050_handle_properties.rb
index b22c51fd..d37b1d03 100644
--- a/ruby/t/tc_050_handle_properties.rb
+++ b/ruby/t/tc_050_handle_properties.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test050HandleProperties < Minitest::Test
def test_050_handle_properties
diff --git a/ruby/t/tc_060_explicit_close.rb b/ruby/t/tc_060_explicit_close.rb
index 20afd0de..8d103616 100644
--- a/ruby/t/tc_060_explicit_close.rb
+++ b/ruby/t/tc_060_explicit_close.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test060ExplicitClose < Minitest::Test
def test_060_explicit_close
diff --git a/ruby/t/tc_070_optargs.rb b/ruby/t/tc_070_optargs.rb
index a2360b2f..c2298131 100644
--- a/ruby/t/tc_070_optargs.rb
+++ b/ruby/t/tc_070_optargs.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test070Optargs < Minitest::Test
def test_070_optargs
diff --git a/ruby/t/tc_090_retvalues.rb b/ruby/t/tc_090_retvalues.rb
index c9a84276..d7927465 100644
--- a/ruby/t/tc_090_retvalues.rb
+++ b/ruby/t/tc_090_retvalues.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test090RetValues < Minitest::Test
def test_090_retvalues
diff --git a/ruby/t/tc_100_launch.rb b/ruby/t/tc_100_launch.rb
index 096cbd62..c4da234e 100644
--- a/ruby/t/tc_100_launch.rb
+++ b/ruby/t/tc_100_launch.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test100Launch < Minitest::Test
def test_100_launch
diff --git a/ruby/t/tc_410_close_event.rb b/ruby/t/tc_410_close_event.rb
index 9a4e0558..84cc11ab 100644
--- a/ruby/t/tc_410_close_event.rb
+++ b/ruby/t/tc_410_close_event.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test410CloseEvent < Minitest::Test
def test_410_close_event
diff --git a/ruby/t/tc_420_log_messages.rb b/ruby/t/tc_420_log_messages.rb
index a113c62e..fd3049a0 100644
--- a/ruby/t/tc_420_log_messages.rb
+++ b/ruby/t/tc_420_log_messages.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test420LogMessages < Minitest::Test
def test_420_log_messages
diff --git a/ruby/t/tc_800_rhbz507346.rb b/ruby/t/tc_800_rhbz507346.rb
index 06767352..54f7734f 100644
--- a/ruby/t/tc_800_rhbz507346.rb
+++ b/ruby/t/tc_800_rhbz507346.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test800RHBZ507346 < Minitest::Test
def test_800_rhbz507346
diff --git a/ruby/t/tc_810_rhbz664558c6.rb b/ruby/t/tc_810_rhbz664558c6.rb
index 1504c070..5ffa2265 100644
--- a/ruby/t/tc_810_rhbz664558c6.rb
+++ b/ruby/t/tc_810_rhbz664558c6.rb
@@ -19,7 +19,8 @@
# the interpreter to segfault. See:
# https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test810RHBZ664558C6 < Minitest::Test
def test_810_rhbz_664558c6
diff --git a/ruby/t/tc_820_rhbz1046509.rb b/ruby/t/tc_820_rhbz1046509.rb
index 0595293d..b2a6d80b 100644
--- a/ruby/t/tc_820_rhbz1046509.rb
+++ b/ruby/t/tc_820_rhbz1046509.rb
@@ -18,7 +18,8 @@
# Test that we don't break the old ::create module function while
# fixing https://bugzilla.redhat.com/show_bug.cgi?id=1046509
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test820RHBZ1046509 < Minitest::Test
def _handleok(g)
diff --git a/ruby/t/test_helper.rb b/ruby/t/test_helper.rb
deleted file mode 100644
index 54f857ce..00000000
--- a/ruby/t/test_helper.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2009-2023 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-begin
- require 'minitest/autorun'
-rescue LoadError
- require 'test/unit'
- MiniTest = Test
- module Test
- Assertions = Unit::Assertions
- module Assertions
- alias refute_nil assert_not_nil
- end
- end
-end
-
-$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
-$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
-require 'guestfs'

View File

@ -1,63 +0,0 @@
From 7408a59c6b43253cc7323269258851fb6be287c4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 26 Oct 2023 21:06:21 +0100
Subject: [PATCH] generator: Sort virt-customize options into alphabetical
order
(cherry picked from commit 297db5cccc1eb6e838f35d38e60fac894b372676)
---
generator/customize.ml | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/generator/customize.ml b/generator/customize.ml
index fe87ef5e..c3dd259e 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -510,23 +510,6 @@ You can have multiple I<--ssh-inject> options, for different users
and also for more keys for each user."
};
- { op_name = "truncate";
- op_type = String "FILE";
- op_discrim = "`Truncate";
- op_shortdesc = "Truncate a file to zero size";
- op_pod_longdesc = "\
-This command truncates C<FILE> to a zero-length file. The file must exist
-already.";
- };
-
- { op_name = "truncate-recursive";
- op_type = String "PATH";
- op_discrim = "`TruncateRecursive";
- op_shortdesc = "Recursively truncate all files in directory";
- op_pod_longdesc = "\
-This command recursively truncates all files under C<PATH> to zero-length.";
- };
-
{ op_name = "timezone";
op_type = String "TIMEZONE";
op_discrim = "`Timezone";
@@ -544,6 +527,23 @@ string like C<Europe/London>";
This command performs a L<touch(1)>-like operation on C<FILE>.";
};
+ { op_name = "truncate";
+ op_type = String "FILE";
+ op_discrim = "`Truncate";
+ op_shortdesc = "Truncate a file to zero size";
+ op_pod_longdesc = "\
+This command truncates C<FILE> to a zero-length file. The file must exist
+already.";
+ };
+
+ { op_name = "truncate-recursive";
+ op_type = String "PATH";
+ op_discrim = "`TruncateRecursive";
+ op_shortdesc = "Recursively truncate all files in directory";
+ op_pod_longdesc = "\
+This command recursively truncates all files under C<PATH> to zero-length.";
+ };
+
{ op_name = "uninstall";
op_type = StringList "PKG,PKG..";
op_discrim = "`UninstallPackages";

View File

@ -1,173 +0,0 @@
From 3cf513cab7bc93a80c8d9f1dea221cba471cafb9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 26 Oct 2023 19:44:03 +0100
Subject: [PATCH] generator: Add new virt-customize --tar-in operation
Using 'virt-customize --tar-in some.tar:/dir -a disk.img' will unpack
'some.tar' into '/dir' in the guest. Note that this will not work for
compressed tar files as written since the underlying guestfs_tar_in
function requires the compression type to be set explicitly and
defaults to no compression (it does not auto-detect or default to
compression).
(cherry picked from commit b5f7b0ec18e30d25342bc322e571edf17a72974f)
---
common | 2 +-
generator/customize.ml | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
Submodule common e70d89a5..9a8ba593:
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index e658a447..ff93630d 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -427,6 +427,14 @@ the C<SELECTOR> field.
You can have multiple I<--ssh-inject> options, for different users
and also for more keys for each user.
+=item B<--tar-in> TARFILE:REMOTEDIR
+
+Copy local files or directories from a local tar file
+called C<TARFILE> into the disk image, placing them in the
+directory C<REMOTEDIR> (which must exist). Note that
+the tar file must be uncompressed (F<.tar.gz> files will not work
+here)
+
=item B<--timezone> TIMEZONE
Set the default timezone of the guest to C<TIMEZONE>. Use a location
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index 5031b015..bb0ce125 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -9,8 +9,9 @@
[--password USER:SELECTOR] [--root-password SELECTOR]
[--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE]
[--sm-attach SELECTOR] [--sm-register] [--sm-remove]
- [--sm-unregister] [--ssh-inject USER[:SELECTOR]] [--truncate FILE]
- [--truncate-recursive PATH] [--timezone TIMEZONE] [--touch FILE]
+ [--sm-unregister] [--ssh-inject USER[:SELECTOR]]
+ [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE]
+ [--truncate FILE] [--truncate-recursive PATH]
[--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
[--write FILE:CONTENT] [--no-logfile]
[--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 3ce901db..245d9960 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -93,14 +93,16 @@ and op = [
(* --sm-unregister *)
| `SSHInject of string * Ssh_key.ssh_key_selector
(* --ssh-inject USER[:SELECTOR] *)
- | `Truncate of string
- (* --truncate FILE *)
- | `TruncateRecursive of string
- (* --truncate-recursive PATH *)
+ | `TarIn of string * string
+ (* --tar-in TARFILE:REMOTEDIR *)
| `Timezone of string
(* --timezone TIMEZONE *)
| `Touch of string
(* --touch FILE *)
+ | `Truncate of string
+ (* --truncate FILE *)
+ | `TruncateRecursive of string
+ (* --truncate-recursive PATH *)
| `UninstallPackages of string list
(* --uninstall PKG,PKG.. *)
| `Update
@@ -418,17 +420,16 @@ let rec argspec () =
),
Some "USER[:SELECTOR]", "Inject an ssh key so the given C<USER> will be able to log in over\nssh without supplying a password. The C<USER> must exist already\nin the guest.\n\nSee L<virt-builder(1)/SSH KEYS> for the format of\nthe C<SELECTOR> field.\n\nYou can have multiple I<--ssh-inject> options, for different users\nand also for more keys for each user.";
(
- [ L"truncate" ],
- Getopt.String (s_"FILE", fun s -> List.push_front (`Truncate s) ops),
- s_"Truncate a file to zero size"
+ [ L"tar-in" ],
+ Getopt.String (
+ s_"TARFILE:REMOTEDIR",
+ fun s ->
+ let p = split_string_pair "tar-in" s in
+ List.push_front (`TarIn p) ops
+ ),
+ s_"Copy local files or directories from a tarball into image"
),
- Some "FILE", "This command truncates C<FILE> to a zero-length file. The file must exist\nalready.";
- (
- [ L"truncate-recursive" ],
- Getopt.String (s_"PATH", fun s -> List.push_front (`TruncateRecursive s) ops),
- s_"Recursively truncate all files in directory"
- ),
- Some "PATH", "This command recursively truncates all files under C<PATH> to zero-length.";
+ Some "TARFILE:REMOTEDIR", "Copy local files or directories from a local tar file\ncalled C<TARFILE> into the disk image, placing them in the\ndirectory C<REMOTEDIR> (which must exist). Note that\nthe tar file must be uncompressed (F<.tar.gz> files will not work\nhere)";
(
[ L"timezone" ],
Getopt.String (s_"TIMEZONE", fun s -> List.push_front (`Timezone s) ops),
@@ -441,6 +442,18 @@ let rec argspec () =
s_"Run touch on a file"
),
Some "FILE", "This command performs a L<touch(1)>-like operation on C<FILE>.";
+ (
+ [ L"truncate" ],
+ Getopt.String (s_"FILE", fun s -> List.push_front (`Truncate s) ops),
+ s_"Truncate a file to zero size"
+ ),
+ Some "FILE", "This command truncates C<FILE> to a zero-length file. The file must exist\nalready.";
+ (
+ [ L"truncate-recursive" ],
+ Getopt.String (s_"PATH", fun s -> List.push_front (`TruncateRecursive s) ops),
+ s_"Recursively truncate all files in directory"
+ ),
+ Some "PATH", "This command recursively truncates all files under C<PATH> to zero-length.";
(
[ L"uninstall" ],
Getopt.String (
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index 112b74dc..51a156ea 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -85,14 +85,16 @@ and op = [
(* --sm-unregister *)
| `SSHInject of string * Ssh_key.ssh_key_selector
(* --ssh-inject USER[:SELECTOR] *)
- | `Truncate of string
- (* --truncate FILE *)
- | `TruncateRecursive of string
- (* --truncate-recursive PATH *)
+ | `TarIn of string * string
+ (* --tar-in TARFILE:REMOTEDIR *)
| `Timezone of string
(* --timezone TIMEZONE *)
| `Touch of string
(* --touch FILE *)
+ | `Truncate of string
+ (* --truncate FILE *)
+ | `TruncateRecursive of string
+ (* --truncate-recursive PATH *)
| `UninstallPackages of string list
(* --uninstall PKG,PKG.. *)
| `Update
diff --git a/generator/customize.ml b/generator/customize.ml
index c3dd259e..e64b45c0 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -510,6 +510,18 @@ You can have multiple I<--ssh-inject> options, for different users
and also for more keys for each user."
};
+ { op_name = "tar-in";
+ op_type = StringPair "TARFILE:REMOTEDIR";
+ op_discrim = "`TarIn";
+ op_shortdesc = "Copy local files or directories from a tarball into image";
+ op_pod_longdesc = "\
+Copy local files or directories from a local tar file
+called C<TARFILE> into the disk image, placing them in the
+directory C<REMOTEDIR> (which must exist). Note that
+the tar file must be uncompressed (F<.tar.gz> files will not work
+here)";
+ };
+
{ op_name = "timezone";
op_type = String "TIMEZONE";
op_discrim = "`Timezone";

View File

@ -1,271 +0,0 @@
From 8dc3b9fb23e4af1b6a5271a7d40d6c2706cf1f78 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 Nov 2023 10:38:59 +0000
Subject: [PATCH] New mailing list email address
(cherry picked from commit 0b8b1e4b2d70cf4ed59775c3c2d1aa42d3c29ca2)
---
.gitpublish | 2 +-
appliance/Makefile.am | 2 +-
po-docs/Makefile.am | 2 +-
po-docs/cs.po | 2 +-
po-docs/de.po | 2 +-
po-docs/en_GB.po | 2 +-
po-docs/es.po | 2 +-
po-docs/eu.po | 2 +-
po-docs/fi.po | 2 +-
po-docs/fr.po | 2 +-
po-docs/ja.po | 2 +-
po-docs/libguestfs-docs.pot | 2 +-
po-docs/nl.po | 2 +-
po-docs/pt_BR.po | 2 +-
po-docs/si.po | 2 +-
po-docs/tg.po | 2 +-
po-docs/uk.po | 2 +-
po-docs/zh_CN.po | 2 +-
python/setup.py.in | 2 +-
19 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/.gitpublish b/.gitpublish
index 9775dd23..2aae0c09 100644
--- a/.gitpublish
+++ b/.gitpublish
@@ -1,3 +1,3 @@
[gitpublishprofile "default"]
base = master
-to = libguestfs@redhat.com
+to = guestfs@lists.libguestfs.org
diff --git a/appliance/Makefile.am b/appliance/Makefile.am
index 063c19f6..8cb9bd1f 100644
--- a/appliance/Makefile.am
+++ b/appliance/Makefile.am
@@ -88,7 +88,7 @@ else
if HAVE_PACMAN
QUERY_FILES_CMD := xargs pacman -Qo | sed -r 's/.* is owned by ([^ ]+) .*/\1/'
else
-$(error Error: Unknown Linux distribution "$(DISTRO)". Please add support to m4/guestfs-appliance.m4 and appliance/Makefile.am and send a patch upstream to libguestfs@redhat.com)
+$(error Error: Unknown Linux distribution "$(DISTRO)". Please add support to m4/guestfs-appliance.m4 and appliance/Makefile.am and send a patch upstream to guestfs@lists.libguestfs.org)
endif !HAVE_PACMAN
endif !HAVE_DPKG
endif !HAVE_RPM
diff --git a/po-docs/Makefile.am b/po-docs/Makefile.am
index 61c1b1c9..330b673f 100644
--- a/po-docs/Makefile.am
+++ b/po-docs/Makefile.am
@@ -46,7 +46,7 @@ libguestfs-docs.pot:
-M utf-8 -L utf-8 \
--package-name $(PACKAGE_NAME) \
--package-version $(PACKAGE_VERSION) \
- --msgid-bugs-address libguestfs@redhat.com \
+ --msgid-bugs-address guestfs@lists.libguestfs.org \
--copyright-holder "Red Hat Inc." \
-p $(abs_srcdir)/$@ \
$(patsubst %,-m %,$(shell cat $(srcdir)/podfiles))
diff --git a/po-docs/cs.po b/po-docs/cs.po
index 5618cb0f..d50e53bf 100644
--- a/po-docs/cs.po
+++ b/po-docs/cs.po
@@ -3,7 +3,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2017-09-11 04:54+0000\n"
"Last-Translator: Zdenek <chmelarz@gmail.com>\n"
diff --git a/po-docs/de.po b/po-docs/de.po
index da449e9f..76abc8d3 100644
--- a/po-docs/de.po
+++ b/po-docs/de.po
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2021-11-18 23:16+0000\n"
"Last-Translator: Ettore Atalan <atalanttore@googlemail.com>\n"
diff --git a/po-docs/en_GB.po b/po-docs/en_GB.po
index 283402a6..75610b9e 100644
--- a/po-docs/en_GB.po
+++ b/po-docs/en_GB.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2015-02-21 10:15+0000\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
diff --git a/po-docs/es.po b/po-docs/es.po
index a163e26d..defbd61d 100644
--- a/po-docs/es.po
+++ b/po-docs/es.po
@@ -9,7 +9,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2023-02-05 15:20+0000\n"
"Last-Translator: Emilio Herrera <ehespinosa57@gmail.com>\n"
diff --git a/po-docs/eu.po b/po-docs/eu.po
index 7f1f634b..63653271 100644
--- a/po-docs/eu.po
+++ b/po-docs/eu.po
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2015-02-21 10:17+0000\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
diff --git a/po-docs/fi.po b/po-docs/fi.po
index d96bfd38..361de115 100644
--- a/po-docs/fi.po
+++ b/po-docs/fi.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.43.1\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-08-12 15:34+0200\n"
"PO-Revision-Date: 2022-12-23 18:20+0000\n"
"Last-Translator: Jan Kuparinen <copper_fin@hotmail.com>\n"
diff --git a/po-docs/fr.po b/po-docs/fr.po
index f411d189..cd903c0e 100644
--- a/po-docs/fr.po
+++ b/po-docs/fr.po
@@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2015-02-21 10:19+0000\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
diff --git a/po-docs/ja.po b/po-docs/ja.po
index 4120b2de..d90437dc 100644
--- a/po-docs/ja.po
+++ b/po-docs/ja.po
@@ -12,7 +12,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2017-02-24 07:33+0000\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
diff --git a/po-docs/libguestfs-docs.pot b/po-docs/libguestfs-docs.pot
index 8e33712f..3954a51e 100644
--- a/po-docs/libguestfs-docs.pot
+++ b/po-docs/libguestfs-docs.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.43.1\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-08-12 15:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
diff --git a/po-docs/nl.po b/po-docs/nl.po
index 571f3523..0cf147ee 100644
--- a/po-docs/nl.po
+++ b/po-docs/nl.po
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2015-02-21 10:33+0000\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
diff --git a/po-docs/pt_BR.po b/po-docs/pt_BR.po
index 87c0059f..229f49c3 100644
--- a/po-docs/pt_BR.po
+++ b/po-docs/pt_BR.po
@@ -3,7 +3,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2017-01-29 09:50+0000\n"
"Last-Translator: Rodrigo de Araujo Sousa Fonseca "
diff --git a/po-docs/si.po b/po-docs/si.po
index e7327945..aa7f5f97 100644
--- a/po-docs/si.po
+++ b/po-docs/si.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.43.1\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-08-12 15:34+0200\n"
"PO-Revision-Date: 2021-08-19 07:04+0000\n"
"Last-Translator: Hela Basa <r45xveza@pm.me>\n"
diff --git a/po-docs/tg.po b/po-docs/tg.po
index 446653ab..9e6fa072 100644
--- a/po-docs/tg.po
+++ b/po-docs/tg.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2015-02-21 10:34+0000\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
diff --git a/po-docs/uk.po b/po-docs/uk.po
index 52b5ce56..960ea8f8 100644
--- a/po-docs/uk.po
+++ b/po-docs/uk.po
@@ -15,7 +15,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2020-08-16 15:29+0000\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
diff --git a/po-docs/zh_CN.po b/po-docs/zh_CN.po
index 7c546775..0c15c1c1 100644
--- a/po-docs/zh_CN.po
+++ b/po-docs/zh_CN.po
@@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libguestfs 1.39.12\n"
-"Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
+"Report-Msgid-Bugs-To: guestfs@lists.libguestfs.org\n"
"POT-Creation-Date: 2020-07-06 15:46+0100\n"
"PO-Revision-Date: 2017-07-24 08:04+0000\n"
"Last-Translator: cheng ye <18969068329@163.com>\n"
diff --git a/python/setup.py.in b/python/setup.py.in
index aa9fb7ad..17571944 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -30,7 +30,7 @@ This package contains the Python bindings for libguestfs.
""",
author='The @PACKAGE_NAME@ team',
- author_email='libguestfs@redhat.com',
+ author_email='guestfs@lists.libguestfs.org',
url='http://libguestfs.org',
license='LGPLv2+',

View File

@ -1,590 +0,0 @@
From 86408417cfe9d742b70104187e52b775e89e497e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 Nov 2023 10:52:11 +0000
Subject: [PATCH] New mailing list archives
(cherry picked from commit b2f3994de26c25d61ed94d2ee3b2ea9600755ee1)
---
README | 2 +-
configure.ac | 2 +-
docs/guestfs-faq.pod | 6 +++---
docs/guestfs-hacking.pod | 2 +-
docs/guestfs-security.pod | 2 +-
docs/guestfs-testing.pod | 2 +-
po-docs/cs.po | 4 ++--
po-docs/de.po | 4 ++--
po-docs/en_GB.po | 8 ++++----
po-docs/es.po | 4 ++--
po-docs/eu.po | 4 ++--
po-docs/fi.po | 12 ++++++------
po-docs/fr.po | 4 ++--
po-docs/ja.po | 6 +++---
po-docs/libguestfs-docs.pot | 12 ++++++------
po-docs/nl.po | 4 ++--
po-docs/pt_BR.po | 4 ++--
po-docs/si.po | 12 ++++++------
po-docs/tg.po | 4 ++--
po-docs/uk.po | 6 +++---
po-docs/zh_CN.po | 4 ++--
website/index.html.in | 2 +-
22 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/README b/README
index 40a7267e..b350edb5 100644
--- a/README
+++ b/README
@@ -6,7 +6,7 @@ disk images. For more information see the home page:
For discussion, development, patches, etc. please use the mailing
list:
- http://www.redhat.com/mailman/listinfo/libguestfs
+ https://lists.libguestfs.org
To find out how to build libguestfs from source, read:
diff --git a/configure.ac b/configure.ac
index b72e99cf..92479e20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -321,7 +321,7 @@ echo "If any optional component is configured 'no' when you expected 'yes'"
echo "then you should check the preceding messages."
echo
echo "Please report bugs back to the mailing list:"
-echo "http://www.redhat.com/mailman/listinfo/libguestfs"
+echo "https://lists.libguestfs.org"
echo
echo "Next you should type 'make' to build the package,"
echo "then 'make check' to run the tests."
diff --git a/docs/guestfs-faq.pod b/docs/guestfs-faq.pod
index 1e83a9c5..3a03282f 100644
--- a/docs/guestfs-faq.pod
+++ b/docs/guestfs-faq.pod
@@ -106,7 +106,7 @@ contact S<Red Hat Support>: L<http://redhat.com/support>
There is a mailing list, mainly for development, but users are also
welcome to ask questions about libguestfs and the virt tools:
-L<https://www.redhat.com/mailman/listinfo/libguestfs>
+L<https://lists.libguestfs.org>
You can also talk to us on IRC channel C<#guestfs> on Libera Chat.
We're not always around, so please stay in the channel after asking
@@ -1289,7 +1289,7 @@ documented stable API.
=head2 Where do I send patches?
Please send patches to the libguestfs mailing list
-L<https://www.redhat.com/mailman/listinfo/libguestfs>. You don't have
+L<https://lists.libguestfs.org>. You don't have
to be subscribed, but there will be a delay until your posting is
manually approved.
@@ -1302,7 +1302,7 @@ prefer to have a linear history.
Large new features that you intend to contribute should be discussed
on the mailing list first
-(L<https://www.redhat.com/mailman/listinfo/libguestfs>). This avoids
+(L<https://lists.libguestfs.org>). This avoids
disappointment and wasted work if we don't think the feature would fit
into the libguestfs project.
diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod
index e1b47ec1..987697b2 100644
--- a/docs/guestfs-hacking.pod
+++ b/docs/guestfs-hacking.pod
@@ -804,7 +804,7 @@ examining the F<tmp/valgrind*> log files carefully.
=head2 SUBMITTING PATCHES
Submit patches to the mailing list:
-L<http://www.redhat.com/mailman/listinfo/libguestfs>
+L<https://lists.libguestfs.org>
and CC to L<rjones@redhat.com>.
You do not need to subscribe to the mailing list if you dont want to.
diff --git a/docs/guestfs-security.pod b/docs/guestfs-security.pod
index afacb091..60d22952 100644
--- a/docs/guestfs-security.pod
+++ b/docs/guestfs-security.pod
@@ -15,7 +15,7 @@ L<https://access.redhat.com/security/team/contact>
If the security problem is not so serious, you can simply file a bug
(see L</BUGS> below), or send an email to our mailing list
-(L<https://www.redhat.com/mailman/listinfo/libguestfs>). You do not
+(L<https://lists.libguestfs.org>). You do not
need to subscribe to the mailing list to send email, but there will be
a delay while the message is moderated.
diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod
index c7b44928..ee4b26d6 100644
--- a/docs/guestfs-testing.pod
+++ b/docs/guestfs-testing.pod
@@ -21,7 +21,7 @@ or post on the mailing list (registration is B<not> required, but if
you're not registered then you'll have to wait for a moderator to
manually approve your message):
-L<https://www.redhat.com/mailman/listinfo/libguestfs>
+L<https://lists.libguestfs.org>
=head1 TESTS
diff --git a/po-docs/cs.po b/po-docs/cs.po
index d50e53bf..60c29165 100644
--- a/po-docs/cs.po
+++ b/po-docs/cs.po
@@ -16000,7 +16000,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38700,7 +38700,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/de.po b/po-docs/de.po
index 76abc8d3..565cd66f 100644
--- a/po-docs/de.po
+++ b/po-docs/de.po
@@ -16118,7 +16118,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38822,7 +38822,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/en_GB.po b/po-docs/en_GB.po
index 75610b9e..31edb8bf 100644
--- a/po-docs/en_GB.po
+++ b/po-docs/en_GB.po
@@ -17054,12 +17054,12 @@ msgstr "How do I propose a feature?"
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
@@ -42254,8 +42254,8 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
-msgstr "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
+msgstr "L<https://lists.libguestfs.org>"
#. type: =head1
#: ../docs/guestfs-testing.pod:26
diff --git a/po-docs/es.po b/po-docs/es.po
index defbd61d..c84192f4 100644
--- a/po-docs/es.po
+++ b/po-docs/es.po
@@ -16057,7 +16057,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38908,7 +38908,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/eu.po b/po-docs/eu.po
index 63653271..44bc885d 100644
--- a/po-docs/eu.po
+++ b/po-docs/eu.po
@@ -15951,7 +15951,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38651,7 +38651,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/fi.po b/po-docs/fi.po
index 361de115..3ff70b33 100644
--- a/po-docs/fi.po
+++ b/po-docs/fi.po
@@ -13507,7 +13507,7 @@ msgstr ""
msgid ""
"There is a mailing list, mainly for development, but users are also welcome "
"to ask questions about libguestfs and the virt tools: "
-"L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+"L<https://lists.libguestfs.org>"
msgstr ""
#. type: textblock
@@ -15849,7 +15849,7 @@ msgstr ""
#: docs/guestfs-faq.pod:1285
msgid ""
"Please send patches to the libguestfs mailing list "
-"L<https://www.redhat.com/mailman/listinfo/libguestfs>. You don't have to be "
+"L<https://lists.libguestfs.org>. You don't have to be "
"subscribed, but there will be a delay until your posting is manually "
"approved."
msgstr ""
@@ -15872,7 +15872,7 @@ msgstr ""
#: docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -17816,7 +17816,7 @@ msgstr ""
#: docs/guestfs-hacking.pod:840
msgid ""
"Submit patches to the mailing list: "
-"L<http://www.redhat.com/mailman/listinfo/libguestfs> and CC to "
+"L<https://lists.libguestfs.org> and CC to "
"L<rjones@redhat.com>."
msgstr ""
@@ -37995,7 +37995,7 @@ msgstr ""
msgid ""
"If the security problem is not so serious, you can simply file a bug (see "
"L</BUGS> below), or send an email to our mailing list "
-"(L<https://www.redhat.com/mailman/listinfo/libguestfs>). You do not need to "
+"(L<https://lists.libguestfs.org>). You do not need to "
"subscribe to the mailing list to send email, but there will be a delay while "
"the message is moderated."
msgstr ""
@@ -38598,7 +38598,7 @@ msgstr ""
#. type: textblock
#: docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/fr.po b/po-docs/fr.po
index cd903c0e..34b6149e 100644
--- a/po-docs/fr.po
+++ b/po-docs/fr.po
@@ -16363,7 +16363,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -40728,7 +40728,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/ja.po b/po-docs/ja.po
index d90437dc..d00d73d2 100644
--- a/po-docs/ja.po
+++ b/po-docs/ja.po
@@ -16574,7 +16574,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -39859,8 +39859,8 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
-msgstr "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
+msgstr "L<https://lists.libguestfs.org>"
#. type: =head1
#: ../docs/guestfs-testing.pod:26
diff --git a/po-docs/libguestfs-docs.pot b/po-docs/libguestfs-docs.pot
index 3954a51e..56d0777b 100644
--- a/po-docs/libguestfs-docs.pot
+++ b/po-docs/libguestfs-docs.pot
@@ -13453,7 +13453,7 @@ msgstr ""
msgid ""
"There is a mailing list, mainly for development, but users are also welcome "
"to ask questions about libguestfs and the virt tools: "
-"L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+"L<https://lists.libguestfs.org>"
msgstr ""
#. type: textblock
@@ -15795,7 +15795,7 @@ msgstr ""
#: docs/guestfs-faq.pod:1285
msgid ""
"Please send patches to the libguestfs mailing list "
-"L<https://www.redhat.com/mailman/listinfo/libguestfs>. You don't have to be "
+"L<https://lists.libguestfs.org>. You don't have to be "
"subscribed, but there will be a delay until your posting is manually "
"approved."
msgstr ""
@@ -15818,7 +15818,7 @@ msgstr ""
#: docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -17762,7 +17762,7 @@ msgstr ""
#: docs/guestfs-hacking.pod:840
msgid ""
"Submit patches to the mailing list: "
-"L<http://www.redhat.com/mailman/listinfo/libguestfs> and CC to "
+"L<https://lists.libguestfs.org> and CC to "
"L<rjones@redhat.com>."
msgstr ""
@@ -37939,7 +37939,7 @@ msgstr ""
msgid ""
"If the security problem is not so serious, you can simply file a bug (see "
"L</BUGS> below), or send an email to our mailing list "
-"(L<https://www.redhat.com/mailman/listinfo/libguestfs>). You do not need to "
+"(L<https://lists.libguestfs.org>). You do not need to "
"subscribe to the mailing list to send email, but there will be a delay while "
"the message is moderated."
msgstr ""
@@ -38542,7 +38542,7 @@ msgstr ""
#. type: textblock
#: docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/nl.po b/po-docs/nl.po
index 0cf147ee..1f8ac7d0 100644
--- a/po-docs/nl.po
+++ b/po-docs/nl.po
@@ -15951,7 +15951,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38651,7 +38651,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/pt_BR.po b/po-docs/pt_BR.po
index 229f49c3..d69895cf 100644
--- a/po-docs/pt_BR.po
+++ b/po-docs/pt_BR.po
@@ -15947,7 +15947,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38647,7 +38647,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/si.po b/po-docs/si.po
index aa7f5f97..de16c4ac 100644
--- a/po-docs/si.po
+++ b/po-docs/si.po
@@ -13455,7 +13455,7 @@ msgstr ""
msgid ""
"There is a mailing list, mainly for development, but users are also welcome "
"to ask questions about libguestfs and the virt tools: "
-"L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+"L<https://lists.libguestfs.org>"
msgstr ""
#. type: textblock
@@ -15797,7 +15797,7 @@ msgstr ""
#: docs/guestfs-faq.pod:1285
msgid ""
"Please send patches to the libguestfs mailing list "
-"L<https://www.redhat.com/mailman/listinfo/libguestfs>. You don't have to be "
+"L<https://lists.libguestfs.org>. You don't have to be "
"subscribed, but there will be a delay until your posting is manually "
"approved."
msgstr ""
@@ -15820,7 +15820,7 @@ msgstr ""
#: docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -17764,7 +17764,7 @@ msgstr ""
#: docs/guestfs-hacking.pod:840
msgid ""
"Submit patches to the mailing list: "
-"L<http://www.redhat.com/mailman/listinfo/libguestfs> and CC to "
+"L<https://lists.libguestfs.org> and CC to "
"L<rjones@redhat.com>."
msgstr ""
@@ -37941,7 +37941,7 @@ msgstr ""
msgid ""
"If the security problem is not so serious, you can simply file a bug (see "
"L</BUGS> below), or send an email to our mailing list "
-"(L<https://www.redhat.com/mailman/listinfo/libguestfs>). You do not need to "
+"(L<https://lists.libguestfs.org>). You do not need to "
"subscribe to the mailing list to send email, but there will be a delay while "
"the message is moderated."
msgstr ""
@@ -38544,7 +38544,7 @@ msgstr ""
#. type: textblock
#: docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/tg.po b/po-docs/tg.po
index 9e6fa072..80db7183 100644
--- a/po-docs/tg.po
+++ b/po-docs/tg.po
@@ -15952,7 +15952,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38652,7 +38652,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/po-docs/uk.po b/po-docs/uk.po
index 960ea8f8..40c96852 100644
--- a/po-docs/uk.po
+++ b/po-docs/uk.po
@@ -19726,7 +19726,7 @@ msgstr "Як запропонувати нову можливість?"
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -47713,8 +47713,8 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
-msgstr "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
+msgstr "L<https://lists.libguestfs.org>"
#. type: =head1
#: ../docs/guestfs-testing.pod:26
diff --git a/po-docs/zh_CN.po b/po-docs/zh_CN.po
index 0c15c1c1..1ad0e1cd 100644
--- a/po-docs/zh_CN.po
+++ b/po-docs/zh_CN.po
@@ -15954,7 +15954,7 @@ msgstr ""
#: ../docs/guestfs-faq.pod:1297
msgid ""
"Large new features that you intend to contribute should be discussed on the "
-"mailing list first (L<https://www.redhat.com/mailman/listinfo/libguestfs>). "
+"mailing list first (L<https://lists.libguestfs.org>). "
"This avoids disappointment and wasted work if we don't think the feature "
"would fit into the libguestfs project."
msgstr ""
@@ -38654,7 +38654,7 @@ msgstr ""
#. type: textblock
#: ../docs/guestfs-testing.pod:24
-msgid "L<https://www.redhat.com/mailman/listinfo/libguestfs>"
+msgid "L<https://lists.libguestfs.org>"
msgstr ""
#. type: =head1
diff --git a/website/index.html.in b/website/index.html.in
index 91088b59..e7a03d6d 100644
--- a/website/index.html.in
+++ b/website/index.html.in
@@ -54,7 +54,7 @@ guestfish --ro -i -a disk.img
<p>
Join us on
-the <a href="http://www.redhat.com/mailman/listinfo/libguestfs">libguestfs
+the <a href="https://lists.libguestfs.org">libguestfs
mailing list</a>, or on IRC channel <code>#guestfs</code>
on <a href="https://libera.chat/">Libera Chat</a>.
</p>

View File

@ -1,25 +0,0 @@
From f6f2f56535a54a90a5c02974eba09bb7a8f0709c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Nov 2023 14:04:33 +0000
Subject: [PATCH] lib: Include <libxml/parser.h> for xmlReadMemory
Since libxml2 2.12.1 including this header is required to have this
function declared.
(cherry picked from commit 02c39dc5e8109ddb911d90759883a504008ba509)
---
lib/launch-libvirt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index d4bf1a8f..79465dd4 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -38,6 +38,7 @@
#include <libvirt/virterror.h>
#endif
+#include <libxml/parser.h>
#include <libxml/xmlwriter.h>
#include <libxml/xpath.h>

View File

@ -1,132 +0,0 @@
From 836b63ce6d6a47f0d8179ccd3c96ce152396ba77 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 13 Dec 2023 22:50:56 +0000
Subject: [PATCH] ocaml: Use Gc.finalise instead of a C finalizer
Since OCaml 5.1.1, changes to custom blocks caused C finalizers that
call caml_enter_blocking_section to stop working (if they ever did
before). They are relatively inflexible compared to registering an
OCaml finalizer (Gc.finalise) to call Guestfs.close, so use that
instead.
Suggested-by: Guillaume Munch-Maccagnoni
See: https://github.com/ocaml/ocaml/issues/12820
See: https://gitlab.com/nbdkit/libnbd/-/commit/db48794fa89547a4799b832331e82b4b8b98f03d
(cherry picked from commit 61418535ad63b5a2a91f1caf4703d7134834e4dd)
---
generator/OCaml.ml | 7 ++++-
ocaml/guestfs-c.c | 69 +++++++++++++++++++++-------------------------
2 files changed, 37 insertions(+), 39 deletions(-)
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index 07ccd269..1e6f603a 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -312,10 +312,15 @@ type t
exception Error of string
exception Handle_closed of string
-external create : ?environment:bool -> ?close_on_exit:bool -> unit -> t =
+external _create : ?environment:bool -> ?close_on_exit:bool -> unit -> t =
\"guestfs_int_ocaml_create\"
external close : t -> unit = \"guestfs_int_ocaml_close\"
+let create ?environment ?close_on_exit () =
+ let g = _create ?environment ?close_on_exit () in
+ Gc.finalise close g;
+ g
+
type event =
";
List.iter (
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 8a8761e8..700c33ab 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -61,43 +61,10 @@ value guestfs_int_ocaml_delete_event_callback (value gv, value eh);
value guestfs_int_ocaml_event_to_string (value events);
value guestfs_int_ocaml_last_errno (value gv);
-/* Allocate handles and deal with finalization. */
-static void
-guestfs_finalize (value gv)
-{
- guestfs_h *g = Guestfs_val (gv);
-
- if (g) {
- /* There is a nasty, difficult to solve case here where the
- * user deletes events in one of the callbacks that we are
- * about to invoke, resulting in a double-free. XXX
- */
- size_t len;
- value **roots = get_all_event_callbacks (g, &len);
-
- /* Close the handle: this could invoke callbacks from the list
- * above, which is why we don't want to delete them before
- * closing the handle.
- */
- caml_release_runtime_system ();
- guestfs_close (g);
- caml_acquire_runtime_system ();
-
- /* Now unregister the global roots. */
- if (roots && len > 0) {
- size_t i;
- for (i = 0; i < len; ++i) {
- caml_remove_generational_global_root (roots[i]);
- free (roots[i]);
- }
- free (roots);
- }
- }
-}
-
+/* Allocate handles. */
static struct custom_operations guestfs_custom_operations = {
(char *) "guestfs_custom_operations",
- guestfs_finalize,
+ custom_finalize_default,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
@@ -179,11 +146,37 @@ value
guestfs_int_ocaml_close (value gv)
{
CAMLparam1 (gv);
+ guestfs_h *g = Guestfs_val (gv);
- guestfs_finalize (gv);
+ if (g) {
+ /* There is a nasty, difficult to solve case here where the
+ * user deletes events in one of the callbacks that we are
+ * about to invoke, resulting in a double-free. XXX
+ */
+ size_t len;
+ value **roots = get_all_event_callbacks (g, &len);
- /* So we don't double-free in the finalizer. */
- Guestfs_val (gv) = NULL;
+ /* Close the handle: this could invoke callbacks from the list
+ * above, which is why we don't want to delete them before
+ * closing the handle.
+ */
+ caml_release_runtime_system ();
+ guestfs_close (g);
+ caml_acquire_runtime_system ();
+
+ /* Now unregister the global roots. */
+ if (roots && len > 0) {
+ size_t i;
+ for (i = 0; i < len; ++i) {
+ caml_remove_generational_global_root (roots[i]);
+ free (roots[i]);
+ }
+ free (roots);
+ }
+
+ /* So we don't double-free. */
+ Guestfs_val (gv) = NULL;
+ }
CAMLreturn (Val_unit);
}

View File

@ -1,39 +0,0 @@
From a534de4f269ea3c2671b99172063e872204fb978 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Dec 2023 08:33:10 +0000
Subject: [PATCH] ocaml: Nullify custom block before releasing runtime lock
Avoids a potential, though if possible then very rare, double free
path.
Suggested-by: Guillaume Munch-Maccagnoni
See: https://github.com/ocaml/ocaml/issues/12820
(cherry picked from commit e93fd7e8acf34192c0d1b70611e3474dde346941)
---
ocaml/guestfs-c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 700c33ab..ea9a0598 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -156,6 +156,9 @@ guestfs_int_ocaml_close (value gv)
size_t len;
value **roots = get_all_event_callbacks (g, &len);
+ /* So we don't double-free. */
+ Guestfs_val (gv) = NULL;
+
/* Close the handle: this could invoke callbacks from the list
* above, which is why we don't want to delete them before
* closing the handle.
@@ -173,9 +176,6 @@ guestfs_int_ocaml_close (value gv)
}
free (roots);
}
-
- /* So we don't double-free. */
- Guestfs_val (gv) = NULL;
}
CAMLreturn (Val_unit);

View File

@ -1,162 +0,0 @@
From 7073e06b2e45ad1544e715d308662a00a6aa20ae Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Dec 2023 09:03:49 +0000
Subject: [PATCH] Update common submodule
The list of patches is below. The one which matters for guestfish is
addition of --key all:... selector.
Andrey Drobyshev (1):
mldrivers: look for bootloader config in /boot/grub/grub.cfg in case of UEFI
Richard W.M. Jones (5):
mlxml: Include <libxml/parser.h> for xmlReadMemory
options/keys.c: Rewrite confusing match statement
options: Rewrite --key documentation fragment
options: Allow --key all:SELECTOR to be used to match any device
mltools/libosinfo-c.c: Fix off-by-one error
Fixes: https://issues.redhat.com/browse/RHEL-19367
(cherry picked from commit 7fd41b5a02b7a9d217150fa49940115a98aae329)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 9a8ba593..0dba002c:
diff --git a/common/mldrivers/linux_bootloaders.ml b/common/mldrivers/linux_bootloaders.ml
index 6f8857ef..91c5ab9e 100644
--- a/common/mldrivers/linux_bootloaders.ml
+++ b/common/mldrivers/linux_bootloaders.ml
@@ -375,6 +375,18 @@ let detect_bootloader (g : G.guestfs) root i_firmware =
with G.Error msg ->
error (f_"could not find bootloader mount point (%s): %s") mp msg in
+ (*
+ * Workaround for older UEFI-based Debian which may not have
+ * /boot/efi/EFI/debian/grub.cfg.
+ *)
+ let paths =
+ if g#exists "/boot/grub/grub.cfg" then
+ match i_firmware with
+ | Firmware.I_BIOS -> paths
+ | I_UEFI _ -> paths @ ["/boot/grub/grub.cfg"]
+ else paths
+ in
+
(* We can determine if the bootloader config file is grub 1 or
* grub 2 just by looking at the filename.
*)
diff --git a/common/mltools/libosinfo-c.c b/common/mltools/libosinfo-c.c
index 93357fd9..a48c8989 100644
--- a/common/mltools/libosinfo-c.c
+++ b/common/mltools/libosinfo-c.c
@@ -296,7 +296,7 @@ v2v_osinfo_os_get_device_drivers (value osv)
driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i));
- vi = caml_alloc (6, 0);
+ vi = caml_alloc (7, 0);
str = osinfo_device_driver_get_architecture (driver);
copyv = caml_copy_string (str);
Store_field (vi, 0, copyv);
diff --git a/common/mlxml/xml-c.c b/common/mlxml/xml-c.c
index 715c3bb2..e024bd8a 100644
--- a/common/mlxml/xml-c.c
+++ b/common/mlxml/xml-c.c
@@ -34,6 +34,7 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
+#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <libxml/uri.h>
diff --git a/common/options/key-option.pod b/common/options/key-option.pod
index 6bc04df1..1470d863 100644
--- a/common/options/key-option.pod
+++ b/common/options/key-option.pod
@@ -1,22 +1,37 @@
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
-the inspection. C<ID> can be either the libguestfs device name, or
-the UUID of the LUKS device.
+the inspection.
=over 4
-=item B<--key> C<ID>:key:KEY_STRING
+=item B<--key> NAMEB<:key:>KEY_STRING
+
+=item B<--key> UUIDB<:key:>KEY_STRING
+
+=item B<--key> B<all:key:>KEY_STRING
+
+C<NAME> is the libguestfs device name (eg. C</dev/sda1>). C<UUID> is
+the device UUID. C<all> means try the key against any encrypted
+device.
Use the specified C<KEY_STRING> as passphrase.
-=item B<--key> C<ID>:file:FILENAME
+=item B<--key> NAMEB<:file:>FILENAME
+
+=item B<--key> UUIDB<:file:>FILENAME
+
+=item B<--key> B<all:file:>FILENAME
Read the passphrase from F<FILENAME>.
-=item B<--key> C<ID>:clevis
+=item B<--key> NAMEB<:clevis>
-Attempt passphrase-less unlocking for C<ID> with Clevis, over the
+=item B<--key> UUIDB<:clevis>
+
+=item B<--key> B<all:clevis>
+
+Attempt passphrase-less unlocking for the device with Clevis, over the
network. Please refer to L<guestfs(3)/ENCRYPTED DISKS> for more
information on network-bound disk encryption (NBDE).
diff --git a/common/options/keys.c b/common/options/keys.c
index 52b27369..87acba51 100644
--- a/common/options/keys.c
+++ b/common/options/keys.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <unistd.h>
#include <termios.h>
#include <string.h>
@@ -152,9 +153,13 @@ get_keys (struct key_store *ks, const char *device, const char *uuid,
if (ks) {
for (i = 0; i < ks->nr_keys; ++i) {
struct key_store_key *key = &ks->keys[i];
+ bool key_id_matches_this_device;
- if (STRNEQ (key->id, device) && (!uuid || STRNEQ (key->id, uuid)))
- continue;
+ key_id_matches_this_device =
+ STREQ (key->id, "all") || /* special string "all" matches any device */
+ STREQ (key->id, device) ||
+ (uuid && STREQ (key->id, uuid));
+ if (!key_id_matches_this_device) continue;
switch (key->type) {
case key_string:
diff --git a/common/options/options.h b/common/options/options.h
index 94e8b9ee..dcb15c28 100644
--- a/common/options/options.h
+++ b/common/options/options.h
@@ -109,6 +109,8 @@ struct key_store_key {
* device name, or the UUID.
*
* There may be multiple matching devices in the list.
+ *
+ * This may be the special string "all" which matches any device.
*/
char *id;

View File

@ -1,35 +0,0 @@
From 5de9915acd31ffe430adc0df497173032560311c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Dec 2023 09:15:08 +0000
Subject: [PATCH] tests: Test guestfish --key all:... selector
(cherry picked from commit 40f43cc8ea6bd556749ee7ba280971aa8b043d27)
---
.../luks/test-key-option-inspect-luks-on-lvm.sh | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/luks/test-key-option-inspect-luks-on-lvm.sh b/tests/luks/test-key-option-inspect-luks-on-lvm.sh
index 932862b1..2b60c797 100755
--- a/tests/luks/test-key-option-inspect-luks-on-lvm.sh
+++ b/tests/luks/test-key-option-inspect-luks-on-lvm.sh
@@ -119,3 +119,20 @@ eval "$fish_ref"
# Repeat the test.
check_filesystems
+
+# Exit the current guestfish background process.
+guestfish --remote -- exit
+GUESTFISH_PID=
+
+# Test the --key all:... selector.
+keys_by_mapper_lvname=(
+ --key all:key:FEDORA-Root
+ --key all:key:FEDORA-LV1
+ --key all:key:FEDORA-LV2
+ --key all:key:FEDORA-LV3
+)
+fish_ref=$("${guestfish[@]}" "${keys_by_mapper_lvname[@]}")
+eval "$fish_ref"
+
+# Repeat the test.
+check_filesystems

View File

@ -1,44 +0,0 @@
From 118b93a189be2d39d2dc20ef059c9b38c60fe8be Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 19 Jan 2024 13:18:00 +0000
Subject: [PATCH] generator/customize.ml: Split --chown parameter on ':'
character
The previous code split it on ',' which was completely wrong.
(It reveals the lack of testing however).
Fixes: commit c08032ebe2763f5e9ce5b14e003721475219d390
Reported-by: Yongkui Guo
(cherry picked from commit e9a728bb22dfa1de5328fbbe7d6d7acad2dbed64)
---
common | 2 +-
generator/customize.ml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Submodule common 0dba002c..54869c98:
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 245d9960..48ee3344 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -157,7 +157,7 @@ let rec argspec () =
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
and split_string_triplet option_name arg =
- match String.nsplit ~max:3 "," arg with
+ match String.nsplit ~max:3 ":" arg with
| [a; b; c] -> a, b, c
| _ ->
error (f_"invalid format for '--%s' parameter, see the man page")
diff --git a/generator/customize.ml b/generator/customize.ml
index e64b45c0..e2c4b605 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -775,7 +775,7 @@ let rec argspec () =
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
and split_string_triplet option_name arg =
- match String.nsplit ~max:3 \",\" arg with
+ match String.nsplit ~max:3 \":\" arg with
| [a; b; c] -> a, b, c
| _ ->
error (f_\"invalid format for '--%%s' parameter, see the man page\")

View File

@ -1,65 +0,0 @@
From f1ced749d4b714e98c82a971ac60148f95312812 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 24 Apr 2024 12:23:34 +0100
Subject: [PATCH] Update common submodule
In particular pick this:
commit 93a7f3af5c23ece6a8e092827ed5928a8973fd3c
Author: Richard W.M. Jones <rjones@redhat.com>
Date: Wed Apr 24 12:08:01 2024 +0100
options: Allow nbd+unix:// URIs
(cherry picked from commit 7968de46f17eed7f18c200c6528ebdfec5c3f279)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 54869c98..93a7f3af:
diff --git a/common/options/uri.c b/common/options/uri.c
index 84d393c1..9180d6a2 100644
--- a/common/options/uri.c
+++ b/common/options/uri.c
@@ -99,7 +99,7 @@ is_uri (const char *arg)
return 0;
for (p--; p >= arg; p--) {
- if (!c_islower (*p))
+ if (! (c_islower (*p) || *p == '+'))
return 0;
}
@@ -148,7 +148,10 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
}
*/
- *protocol_ret = strdup (uri->scheme);
+ if (STREQ (uri->scheme, "nbd+unix"))
+ *protocol_ret = strdup ("nbd");
+ else
+ *protocol_ret = strdup (uri->scheme);
if (*protocol_ret == NULL) {
perror ("strdup: protocol");
return -1;
@@ -194,7 +197,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
if (path && path[0] == '/' &&
(STREQ (uri->scheme, "gluster") ||
STREQ (uri->scheme, "iscsi") ||
- STREQ (uri->scheme, "nbd") ||
+ STRPREFIX (uri->scheme, "nbd") ||
STREQ (uri->scheme, "rbd") ||
STREQ (uri->scheme, "sheepdog")))
path++;
diff --git a/common/progress/progress.c b/common/progress/progress.c
index e4b30663..5848abd7 100644
--- a/common/progress/progress.c
+++ b/common/progress/progress.c
@@ -123,6 +123,7 @@ progress_bar_init (unsigned flags)
bar->machine_readable = 1;
bar->utf8_mode = 0;
bar->have_terminfo = 0;
+ bar->fp = NULL;
} else {
bar->machine_readable = 0;

View File

@ -1,86 +0,0 @@
From 04a45af93d21880e54a386386313100a04b91ca7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Jul 2024 14:37:22 +0100
Subject: [PATCH] New APIs: findfs_partuuid and findfs_partlabel
These search for partitions by UUID or label (name). They only work
for GPT.
(cherry picked from commit 1816651f3c138600ad2e5ba0d6437b4753333818)
---
daemon/findfs.ml | 4 ++++
generator/actions_core.ml | 24 ++++++++++++++++++++++++
generator/proc_nr.ml | 2 ++
lib/MAX_PROC_NR | 2 +-
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/daemon/findfs.ml b/daemon/findfs.ml
index cf2ba4a8..a94e0ce7 100644
--- a/daemon/findfs.ml
+++ b/daemon/findfs.ml
@@ -27,6 +27,10 @@ let rec findfs_uuid uuid =
findfs "UUID" uuid
and findfs_label label =
findfs "LABEL" label
+and findfs_partuuid uuid =
+ findfs "PARTUUID" uuid
+and findfs_partlabel label =
+ findfs "PARTLABEL" label
and findfs tag str =
(* Kill the cache file, forcing blkid to reread values from the
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index 314bb0ae..c3afe810 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -5688,6 +5688,30 @@ filesystem can be found.
To find the label of a filesystem, use C<guestfs_vfs_label>." };
+ { defaults with
+ name = "findfs_partuuid"; added = (1, 5, 3);
+ style = RString (RDevice, "device"), [String (PlainString, "uuid")], [];
+ impl = OCaml "Findfs.findfs_partuuid";
+ shortdesc = "find a partition by UUID";
+ longdesc = "\
+This command searches the partitions and returns the one
+which has the given partition UUID. An error is returned if no such
+partition can be found.
+
+To find the UUID of a partition, use C<guestfs_blkid> (C<PART_ENTRY_UUID>)." };
+
+ { defaults with
+ name = "findfs_partlabel"; added = (1, 5, 3);
+ style = RString (RDevice, "device"), [String (PlainString, "label")], [];
+ impl = OCaml "Findfs.findfs_partlabel";
+ shortdesc = "find a partition by label";
+ longdesc = "\
+This command searches the partitions and returns the one
+which has the given label. An error is returned if no such
+partition can be found.
+
+To find the label of a partition, use C<guestfs_blkid> (C<PART_ENTRY_NAME>)." };
+
{ defaults with
name = "is_chardev"; added = (1, 5, 10);
style = RBool "flag", [String (Pathname, "path")], [OBool "followsymlinks"];
diff --git a/generator/proc_nr.ml b/generator/proc_nr.ml
index f71a849c..56cd97a9 100644
--- a/generator/proc_nr.ml
+++ b/generator/proc_nr.ml
@@ -516,6 +516,8 @@ let proc_nr = [
511, "internal_readdir";
512, "clevis_luks_unlock";
513, "inspect_get_build_id";
+514, "findfs_partuuid";
+515, "findfs_partlabel";
]
(* End of list. If adding a new entry, add it at the end of the list
diff --git a/lib/MAX_PROC_NR b/lib/MAX_PROC_NR
index 31cf34b8..3cda32fc 100644
--- a/lib/MAX_PROC_NR
+++ b/lib/MAX_PROC_NR
@@ -1 +1 @@
-513
+515

View File

@ -1,41 +0,0 @@
From ebce03824a3ce75823037003ca2311d7b8d61565 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Jul 2024 14:39:16 +0100
Subject: [PATCH] inspection: Resolve PARTUUID= and PARTLABEL= in /etc/fstab
Fixes: https://issues.redhat.com/browse/RHEL-46596
(cherry picked from commit e616c8f286ddacf401d7c356724ae874ed883262)
---
daemon/inspect_fs_unix_fstab.ml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml
index 837c8c62..f5817a31 100644
--- a/daemon/inspect_fs_unix_fstab.ml
+++ b/daemon/inspect_fs_unix_fstab.ml
@@ -131,6 +131,25 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
with
Failure _ -> return None
)
+ (* EFI partition UUIDs and labels. *)
+ else if String.is_prefix spec "PARTUUID=" then (
+ let uuid = String.sub spec 9 (String.length spec - 9) in
+ let uuid = shell_unquote uuid in
+ (* Just ignore the device if the UUID cannot be resolved. *)
+ try
+ Mountable.of_device (Findfs.findfs_partuuid uuid)
+ with
+ Failure _ -> return None
+ )
+ else if String.is_prefix spec "PARTLABEL=" then (
+ let label = String.sub spec 10 (String.length spec - 10) in
+ let label = shell_unquote label in
+ (* Just ignore the device if the label cannot be resolved. *)
+ try
+ Mountable.of_device (Findfs.findfs_partlabel label)
+ with
+ Failure _ -> return None
+ )
(* Resolve /dev/root to the current device.
* Do the same for the / partition of the *BSD
* systems, since the BSD -> Linux device

View File

@ -8,7 +8,8 @@ list:
http://www.redhat.com/mailman/listinfo/libguestfs http://www.redhat.com/mailman/listinfo/libguestfs
This package comes with a lot of help and examples to get you started. This Red Hat Enterprise Linux package comes with a lot of help and
examples to get you started.
The first place to start are the manual pages. Type: The first place to start are the manual pages. Type:
@ -19,19 +20,19 @@ The first place to start are the manual pages. Type:
man virt-cat # and other virt-* tools man virt-cat # and other virt-* tools
If you install the libguestfs-devel package, then in the If you install the libguestfs-devel package, then in the
/usr/share/doc/libguestfs-devel/ directory you will find other /usr/share/doc/libguestfs-devel/ directory you will also
documentation including: find:
- BUGS: list of open bugs in this version - BUGS: list of open bugs in this version
- ChangeLog.gz: the detailed list of changes in this version - ChangeLog: the detailed list of changes in this version
- HACKING: how to extend libguestfs - ROADMAP: the roadmap for future versions
- TODO: ideas for extending libguestfs - TODO: ideas for extending libguestfs
- *.c: example C programs using the API - *.c: example C programs using the API
- *.xml.gz: example virt-inspector output (compressed) - *.xml: example virt-inspector output
- virt-inspector.rng: virt-inspector RelaxNG schema - *.rng: virt-inspector RelaxNG schema

View File

@ -6,29 +6,24 @@ set -e
# directory. Use it like this: # directory. Use it like this:
# ./copy-patches.sh # ./copy-patches.sh
project=libguestfs rhel_version=8.7.0
rhel_version=9.5
# Check we're in the right directory. # Check we're in the right directory.
if [ ! -f $project.spec ]; then if [ ! -f libguestfs.spec ]; then
echo "$0: run this from the directory containing '$project.spec'" echo "$0: run this from the directory containing 'libguestfs.spec'"
exit 1 exit 1
fi fi
case `id -un` in git_checkout=$HOME/d/libguestfs-rhel-$rhel_version
rjones) git_checkout=$HOME/d/$project-rhel-$rhel_version ;;
lacos) git_checkout=$HOME/src/v2v/$project ;;
*) git_checkout=$HOME/d/$project-rhel-$rhel_version ;;
esac
if [ ! -d $git_checkout ]; then if [ ! -d $git_checkout ]; then
echo "$0: $git_checkout does not exist" echo "$0: $git_checkout does not exist"
echo "This script is only for use by the maintainer when preparing a" echo "This script is only for use by the maintainer when preparing a"
echo "$project release on RHEL." echo "libguestfs release on RHEL."
exit 1 exit 1
fi fi
# Get the base version of the project. # Get the base version of libguestfs.
version=`grep '^Version:' $project.spec | awk '{print $2}'` version=`grep '^Version:' libguestfs.spec | awk '{print $2}'`
tag="v$version" tag="v$version"
# Remove any existing patches. # Remove any existing patches.
@ -36,12 +31,7 @@ git rm -f [0-9]*.patch ||:
rm -f [0-9]*.patch rm -f [0-9]*.patch
# Get the patches. # Get the patches.
( (cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag)
cd $git_checkout
rm -f [0-9]*.patch
git -c core.abbrev=8 format-patch -O/dev/null --subject-prefix=PATCH -N \
--submodule=diff --no-signature --patience $tag
)
mv $git_checkout/[0-9]*.patch . mv $git_checkout/[0-9]*.patch .
# Remove any not to be applied. # Remove any not to be applied.
@ -52,7 +42,7 @@ git add [0-9]*.patch
# Print out the patch lines. # Print out the patch lines.
echo echo
echo "--- Copy the following text into $project.spec file" echo "--- Copy the following text into libguestfs.spec file"
echo echo
echo "# Patches." echo "# Patches."

View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAl/1jrcRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKCBcQ/+JwE8JTm3PdTPGoKxCqSgAOirbqE4ZvMY
p/3y5mexagcWXx6X2Y+u6dlybS06jFR8TkbjdE3VAhhJo0C8l1vfvUTWKVDZoBhG
3jZ6e+exff3VEUY4nFIVvYPNP+/J1BCiexMO0/2f1MDKwnJ73je9GlzwPEpdqPj/
jSxaAy1G/rA5qV5rWQd4n5S9m8zRnf1lnM7YI7I0PunC2Wt/U6BZidL/FVVWVBxV
DGKTIy7GgWnfGWdqJ+Wi9o9QCJH/9FGTP35xonyQEM/7GI+jLz+a9g2xgvv584Ni
FF0Gqywrp5QFd13Nj3MPM7MXjGjUY5vB964k3mgE4fH91CnVvisRWfUCCo+c/9wG
odS0YTrveWJpm0oYU2tL3AjahRclskAxXEIxx9kbnWMUTrpXG0r8G4+vE+estCjb
mbyK5FQh2KASqNgmeopjK9DAEwD7SfPyHmPQ07Q76Pgl8X+FfBX2uyXBjaR5IJJJ
qVVamdVtPilqwWqQ8hGkKE0qVKqZHGCOJ8+AkQjHjUtSVegT6zHmCG/bM4im1dGV
r9fv6oQ7kWViz8mBluoETWr5sd2AfLOdLS8A42JaOnU7ASJUX/9eN0Y9u4BYC9P3
l+QXikyq6T/4iC+tADOYGBr9uNitksLwSSUYScpnN+4AY+M+qjXTBq38MEHmwcgK
5mwscgQefcY=
=UrAA
-----END PGP SIGNATURE-----

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmaNN5wRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKDZwQ/9ExtAdQIYiR1HtRiHlNDoQw5ADVeHaucD
Gy8KLJHyzCZaPVsim50/Rx9Thipn/jvVCNRoww02D8l5xm7elcqO7//N5OWNeyzO
/SUq/DEspWdfpDJVEQvID3Rtg8ZPJ/7VW9dtMe2nuUNpEyBSeqqQvXoJXzDkhcao
IT604JY7zZqeFzXaZGYyXeZUtnxpv7M/yIDGVjQ2m0WxAkpk3OYIW57bjRRTAI3d
zSnCW1qIITpMb3VtTRKw9FIhr/eZsyeLqA1QlKGKh0HEyrVDwYD+ENH4McKyOUH1
M3pPMxOL5/WpBMpVhQsmospK25+AQRWuzm0w/h6YgP6gPbQLCe7BTkNeWz3n3f8r
W1P+eS0bj1NVs3vZYM0WC8pMx6UaqP6u5T1vH9v+VQ3/ZEqBnU60Jhso5wdQRSgG
GsarBFf2BETZkuMFiUaaKAbDgYYMVW3nsxgurW0pk5kIfeXX1+6xcqoULG/cV879
xhUD11XBrJdCvWnpZ+xTZD3SPP4hlfAlCkHPhFw0+WdTHUEASVRnX+dZzYcAE49d
2S7XsrAphY+l2BCISdJB4OdGSnpWO8M76Y0FbPFO6bx9YJRmIAQPLWbq4RrjtAZ4
CUObvLe54y4OHY7f22qZVg+hWusaTexphfOAMi/rInLgWbzERFlQ0iL8mVd3dQqA
oCoiARM5lzI=
=UhhX
-----END PGP SIGNATURE-----

File diff suppressed because it is too large Load Diff