Compare commits

...

No commits in common. 'c9' and 'i9c-beta' have entirely different histories.
c9 ... i9c-beta

4
.gitignore vendored

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

@ -1,3 +1,3 @@
b2ccc62a61d43917d982bb380709cd283fda465a SOURCES/libguestfs-1.50.1.tar.gz
c2f649ede7121e974884afb1b2dfacb966f9e21e SOURCES/libguestfs-common-1.50.1.tar.gz
9a4fcb78ca452e1cf04f0b541d938ab1b07019a6 SOURCES/libguestfs-1.50.2.tar.gz
f801826d11e360a906bae5980495ac5425d709ae SOURCES/libguestfs-common-1.50.2.tar.gz
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring

@ -1,4 +1,4 @@
From e58cd8df467e342463d08e3d761c2e322287b13e Mon Sep 17 00:00:00 2001
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

@ -1,138 +0,0 @@
From 5c672d1541e7d769e73e6858944d33f66be12f30 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 14 Mar 2023 14:15:05 +0100
Subject: [PATCH] update common submodule
Andrey Drobyshev (2):
inject_virtio_win: add Virtio_SCSI to block_type
inject_virtio_win: write the proper block controller PCI ID to Win registry
Richard W.M. Jones (2):
mlcustomize: Fix overlong comment
mlcustomize: Add accessors for block driver priority list
Roman Kagan (1):
inject_virtio_win: match only vendor/device/revision
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 7414ac40c7df0a8938a05ba50907312b0093d107)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 90e0077e..360e037d:
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index 5f4aab72..2a30b200 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -49,9 +49,12 @@ type t = {
of libosinfo. Although this behaviour is documented, IMHO it has
always been a bad idea. We should change this in future to allow
the user to select where they want to get drivers from. XXX *)
+
+ mutable block_driver_priority : string list
+ (** List of block drivers *)
}
-type block_type = Virtio_blk | IDE
+type block_type = Virtio_blk | Virtio_SCSI | IDE
and net_type = Virtio_net | E1000 | RTL8139
and machine_type = I440FX | Q35 | Virt
@@ -107,13 +110,17 @@ and get_inspection g root =
{ g; root;
i_arch; i_major_version; i_minor_version; i_osinfo;
i_product_variant; i_windows_current_control_set; i_windows_systemroot;
- virtio_win = ""; was_set = false }
+ virtio_win = ""; was_set = false;
+ block_driver_priority = ["virtio_blk"; "vrtioblk"; "viostor"] }
+
+let get_block_driver_priority t = t.block_driver_priority
+let set_block_driver_priority t v = t.block_driver_priority <- v
let scsi_class_guid = "{4D36E97B-E325-11CE-BFC1-08002BE10318}"
-let viostor_legacy_pciid = "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00"
-let viostor_modern_pciid = "VEN_1AF4&DEV_1042&SUBSYS_11001AF4&REV_01"
-let vioscsi_legacy_pciid = "VEN_1AF4&DEV_1004&SUBSYS_00081AF4&REV_00"
-let vioscsi_modern_pciid = "VEN_1AF4&DEV_1048&SUBSYS_11001AF4&REV_01"
+let viostor_legacy_pciid = "VEN_1AF4&DEV_1001&REV_00"
+let viostor_modern_pciid = "VEN_1AF4&DEV_1042&REV_01"
+let vioscsi_legacy_pciid = "VEN_1AF4&DEV_1004&REV_00"
+let vioscsi_modern_pciid = "VEN_1AF4&DEV_1048&REV_01"
let rec inject_virtio_win_drivers ({ g } as t) reg =
(* Copy the virtio drivers to the guest. *)
@@ -176,14 +183,13 @@ let rec inject_virtio_win_drivers ({ g } as t) reg =
else (
(* Can we install the block driver? *)
let block : block_type =
- let filenames = ["virtio_blk"; "vrtioblk"; "viostor"] in
let viostor_driver = try (
Some (
List.find (
fun driver_file ->
let source = driverdir // driver_file ^ ".sys" in
g#exists source
- ) filenames
+ ) t.block_driver_priority
)
) with Not_found -> None in
match viostor_driver with
@@ -194,16 +200,22 @@ let rec inject_virtio_win_drivers ({ g } as t) reg =
IDE
| Some driver_name ->
- (* Block driver needs tweaks to allow booting; the rest is set up by PnP
- * manager *)
+ (* Block driver needs tweaks to allow booting;
+ * the rest is set up by PnP manager.
+ *)
let source = driverdir // (driver_name ^ ".sys") in
let target = sprintf "%s/system32/drivers/%s.sys"
t.i_windows_systemroot driver_name in
let target = g#case_sensitive_path target in
+ let installed_block_type, legacy_pciid, modern_pciid =
+ match driver_name with
+ | "vioscsi" -> Virtio_SCSI, vioscsi_legacy_pciid, vioscsi_modern_pciid
+ | _ -> Virtio_blk, viostor_legacy_pciid, viostor_modern_pciid
+ in
g#cp source target;
- add_guestor_to_registry t reg driver_name viostor_legacy_pciid;
- add_guestor_to_registry t reg driver_name viostor_modern_pciid;
- Virtio_blk in
+ add_guestor_to_registry t reg driver_name legacy_pciid;
+ add_guestor_to_registry t reg driver_name modern_pciid;
+ installed_block_type in
(* Can we install the virtio-net driver? *)
let net : net_type =
diff --git a/common/mlcustomize/inject_virtio_win.mli b/common/mlcustomize/inject_virtio_win.mli
index 0ced02e8..d14f0497 100644
--- a/common/mlcustomize/inject_virtio_win.mli
+++ b/common/mlcustomize/inject_virtio_win.mli
@@ -20,7 +20,7 @@
type t (** Handle *)
-type block_type = Virtio_blk | IDE
+type block_type = Virtio_blk | Virtio_SCSI | IDE
and net_type = Virtio_net | E1000 | RTL8139
and machine_type = I440FX | Q35 | Virt
@@ -64,6 +64,16 @@ val from_environment : Guestfs.guestfs -> string -> string -> t
This should only be used by [virt-v2v] and is considered a legacy method. *)
+val get_block_driver_priority : t -> string list
+val set_block_driver_priority : t -> string list -> unit
+(** Get or set the current block driver priority list. This is
+ a list of virtio-win block driver names (eg. ["viostor"]) that
+ we search until we come to the first [name ^ ".sys"] that
+ we find, and that is the block driver which gets installed.
+
+ This module contains a default priority list which should
+ be suitable for most use cases. *)
+
val inject_virtio_win_drivers : t -> Registry.t -> virtio_win_installed
(** [inject_virtio_win_drivers t reg]
installs virtio drivers from the driver directory or driver

@ -1,4 +1,4 @@
From c1829048c598e11950c9d355fdd5c177a99e046f Mon Sep 17 00:00:00 2001
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

@ -1,88 +0,0 @@
From 89b6c8b458dcb00de83b543c47a6acb049f63f18 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 21 Mar 2023 16:55:15 +0100
Subject: [PATCH] update common submodule
HATAYAMA Daisuke (1):
progress: fix segmentation fault when TERM variable is "dumb"
Laszlo Ersek (2):
detect_kernels: tighten "try" scope
detect_kernels: deal with RHEL's kernel-core / kernel-modules-core split
rwmjones (1):
Merge pull request #5 from d-hatayama/fix_segfault_progress_bar
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175703
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit be11d25b3e2770d86699e94c5087e6625477d5ec)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 360e037d..70c10a07:
diff --git a/common/mldrivers/linux_kernels.ml b/common/mldrivers/linux_kernels.ml
index a46146a1..23ff76a5 100644
--- a/common/mldrivers/linux_kernels.ml
+++ b/common/mldrivers/linux_kernels.ml
@@ -125,9 +125,9 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
*)
let modpath, version =
let prefix = "/lib/modules/" in
+ let prefix_len = String.length prefix in
try
- let prefix_len = String.length prefix in
- List.find_map (
+ let modpath, version = List.find_map (
fun filename ->
let filename_len = String.length filename in
if filename_len > prefix_len &&
@@ -137,17 +137,29 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
Some (filename, version)
) else
None
- ) files
+ ) files in
+ (* Fall back to the version in the vmlinuz file name not only if
+ * a candidate pathname couldn't be found under /lib/modules/,
+ * but also in case the candidate pathname doesn't reference a
+ * directory. See RHBZ#2175703.
+ *
+ * Note that this "is_dir" check is deliberately kept outside of
+ * the "find_map"'s mapper function above: we want the first
+ * candidate *to be* a directory, and not the first candidate
+ * *that is* a directory.
+ *)
+ if not (g#is_dir ~followsymlinks:true modpath) then
+ raise Not_found;
+ modpath, version
with Not_found ->
let version =
String.sub vmlinuz 14 (String.length vmlinuz - 14) in
let modpath = prefix ^ version in
+ (* Check that the modpath exists. *)
+ if not (g#is_dir ~followsymlinks:true modpath) then
+ raise Not_found;
modpath, version in
- (* Check that the modpath exists. *)
- if not (g#is_dir ~followsymlinks:true modpath) then
- raise Not_found;
-
(* Find the initramfs which corresponds to the kernel.
* Since the initramfs is built at runtime, and doesn't have
* to be covered by the RPM file list, this is basically
diff --git a/common/progress/progress.c b/common/progress/progress.c
index 4d52b97e..e4b30663 100644
--- a/common/progress/progress.c
+++ b/common/progress/progress.c
@@ -318,7 +318,8 @@ progress_bar_set (struct progress_bar *bar,
* (b) it's just not possible to use tputs in a sane way here.
*/
/*tputs (UP, 2, putchar);*/
- fprintf (fp, "%s", UP);
+ if (UP)
+ fprintf (fp, "%s", UP);
}
bar->count++;

@ -1,4 +1,4 @@
From 3046af080baad9935627ebb671950448cfd0fa7b Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From ab7e68dbeefe464734bd63a862a36f612f76d396 Mon Sep 17 00:00:00 2001
From 66b9338e3d786db28fbd853d397741c3ceb19352 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Jul 2013 14:47:56 +0100
Subject: [PATCH] RHEL: Disable unsupported remote drive protocols
@ -220,7 +220,7 @@ index 21d42498..ddabeb63 100755
rm test-add-uri.out
rm test-add-uri.img
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index c8d9949b..26c576c7 100644
index bfb43a19..314bb0ae 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -350,29 +350,6 @@ F<filename> is interpreted as a local file or device.

@ -1,4 +1,4 @@
From b74c6c8520773c2ef4a4d69b08b70e5ceeb06964 Mon Sep 17 00:00:00 2001
From b875668bfa9f596aba2e84999c7c9921f8dcb55e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for

@ -1,4 +1,4 @@
From e916ad54c31a725cbf08fb186756d9e968ff20b2 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From e712c4b81cbd2cf0e990d01cb4d1f54734e62de6 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From c95b3086bdbdf840de8d3b24c3ae5e9b847bf588 Mon Sep 17 00:00:00 2001
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
@ -17,7 +17,7 @@ Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
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 c0cb5d0b..6362e225 100755
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

@ -1,4 +1,4 @@
From 15cc20d1f5e0413c1af26c683437995886146eb6 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 1cdc22fa656a44320e9c53401130e98f536c9759 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From feb17e93b4e58131cf6875c4ae638a791a875a22 Mon Sep 17 00:00:00 2001
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

@ -1,203 +0,0 @@
From 194a48aef32367c45c555a4d93fb1a3375b0dead Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 19 May 2023 16:08:47 +0200
Subject: [PATCH] update common submodule
Laszlo Ersek (2):
options/keys: key_store_import_key(): un-constify "key" parameter
options/keys: introduce unescape_device_mapper_lvm()
Richard W.M. Jones (1):
mlcustomize/SELinux_relabel.ml: Use Array.mem
Roman Kagan (1):
mlcustomize: skip SELinux relabeling if it's disabled
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230519140849.310774-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 83afd6d3d2c82ee3a8f22079ba12ef7eac38ac34)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 70c10a07..b636c3f2:
diff --git a/common/mlcustomize/SELinux_relabel.ml b/common/mlcustomize/SELinux_relabel.ml
index 5ecf7bd7..2f3a09bf 100644
--- a/common/mlcustomize/SELinux_relabel.ml
+++ b/common/mlcustomize/SELinux_relabel.ml
@@ -24,10 +24,6 @@ open Printf
module G = Guestfs
-(* Simple reimplementation of Array.mem, available only with OCaml >= 4.03. *)
-let array_find a l =
- List.mem a (Array.to_list l)
-
let rec relabel (g : G.guestfs) =
(* Is the guest using SELinux? (Otherwise this is a no-op). *)
if is_selinux_guest g then (
@@ -59,14 +55,24 @@ and use_setfiles g =
g#aug_load ();
debug_augeas_errors g;
+ let config_path = "/files/etc/selinux/config" in
+ let config_keys = g#aug_ls config_path in
+ (* SELinux may be disabled via a setting in config file *)
+ let selinux_disabled =
+ let selinuxmode_path = config_path ^ "/SELINUX" in
+ if Array.mem selinuxmode_path config_keys then
+ g#aug_get selinuxmode_path = "disabled"
+ else
+ false in
+ if selinux_disabled then
+ failwith "selinux disabled";
+
(* Get the SELinux policy name, eg. "targeted", "minimum".
* Use "targeted" if not specified, just like libselinux does.
*)
let policy =
- let config_path = "/files/etc/selinux/config" in
let selinuxtype_path = config_path ^ "/SELINUXTYPE" in
- let keys = g#aug_ls config_path in
- if array_find selinuxtype_path keys then
+ if Array.mem selinuxtype_path config_keys then
g#aug_get selinuxtype_path
else
"targeted" in
diff --git a/common/options/keys.c b/common/options/keys.c
index 48f1bc7c..52b27369 100644
--- a/common/options/keys.c
+++ b/common/options/keys.c
@@ -260,8 +260,107 @@ key_store_add_from_selector (struct key_store *ks, const char *selector)
return key_store_import_key (ks, &key);
}
+/* Turn /dev/mapper/VG-LV into /dev/VG/LV, in-place. */
+static void
+unescape_device_mapper_lvm (char *id)
+{
+ static const char dev[] = "/dev/", dev_mapper[] = "/dev/mapper/";
+ const char *input_start;
+ char *output;
+ enum { M_SCAN, M_FILL, M_DONE } mode;
+
+ if (!STRPREFIX (id, dev_mapper))
+ return;
+
+ /* Start parsing "VG-LV" from "id" after "/dev/mapper/". */
+ input_start = id + (sizeof dev_mapper - 1);
+
+ /* Start writing the unescaped "VG/LV" output after "/dev/". */
+ output = id + (sizeof dev - 1);
+
+ for (mode = M_SCAN; mode < M_DONE; ++mode) {
+ char c;
+ const char *input = input_start;
+ const char *hyphen_buffered = NULL;
+ bool single_hyphen_seen = false;
+
+ do {
+ c = *input;
+
+ switch (c) {
+ case '-':
+ if (hyphen_buffered == NULL)
+ /* This hyphen may start an escaped hyphen, or it could be the
+ * separator in VG-LV.
+ */
+ hyphen_buffered = input;
+ else {
+ /* This hyphen completes an escaped hyphen; unescape it. */
+ if (mode == M_FILL)
+ *output++ = '-';
+ hyphen_buffered = NULL;
+ }
+ break;
+
+ case '/':
+ /* Slash characters are forbidden in VG-LV anywhere. If there's any,
+ * we'll find it in the first (i.e., scanning) phase, before we output
+ * anything back to "id".
+ */
+ assert (mode == M_SCAN);
+ return;
+
+ default:
+ /* Encountered a non-slash, non-hyphen character -- which also may be
+ * the terminating NUL.
+ */
+ if (hyphen_buffered != NULL) {
+ /* The non-hyphen character comes after a buffered hyphen, so the
+ * buffered hyphen is supposed to be the single hyphen that separates
+ * VG from LV in VG-LV. There are three requirements for this
+ * separator: (a) it must be unique (we must not have seen another
+ * such separator earlier), (b) it must not be at the start of VG-LV
+ * (because VG would be empty that way), (c) it must not be at the end
+ * of VG-LV (because LV would be empty that way). Should any of these
+ * be violated, we'll catch that during the first (i.e., scanning)
+ * phase, before modifying "id".
+ */
+ if (single_hyphen_seen || hyphen_buffered == input_start ||
+ c == '\0') {
+ assert (mode == M_SCAN);
+ return;
+ }
+
+ /* Translate the separator hyphen to a slash character. */
+ if (mode == M_FILL)
+ *output++ = '/';
+ hyphen_buffered = NULL;
+ single_hyphen_seen = true;
+ }
+
+ /* Output the non-hyphen character (including the terminating NUL)
+ * regardless of whether there was a buffered hyphen separator (which,
+ * by now, we'll have attempted to translate and flush).
+ */
+ if (mode == M_FILL)
+ *output++ = c;
+ }
+
+ ++input;
+ } while (c != '\0');
+
+ /* We must have seen the VG-LV separator. If that's not the case, we'll
+ * catch it before modifying "id".
+ */
+ if (!single_hyphen_seen) {
+ assert (mode == M_SCAN);
+ return;
+ }
+ }
+}
+
struct key_store *
-key_store_import_key (struct key_store *ks, const struct key_store_key *key)
+key_store_import_key (struct key_store *ks, struct key_store_key *key)
{
struct key_store_key *new_keys;
@@ -278,6 +377,7 @@ key_store_import_key (struct key_store *ks, const struct key_store_key *key)
error (EXIT_FAILURE, errno, "realloc");
ks->keys = new_keys;
+ unescape_device_mapper_lvm (key->id);
ks->keys[ks->nr_keys] = *key;
++ks->nr_keys;
diff --git a/common/options/options.h b/common/options/options.h
index 94573ee0..94e8b9ee 100644
--- a/common/options/options.h
+++ b/common/options/options.h
@@ -169,7 +169,8 @@ extern struct matching_key *get_keys (struct key_store *ks, const char *device,
const char *uuid, size_t *nr_matches);
extern void free_keys (struct matching_key *keys, size_t nr_matches);
extern struct key_store *key_store_add_from_selector (struct key_store *ks, const char *selector);
-extern struct key_store *key_store_import_key (struct key_store *ks, const struct key_store_key *key);
+extern struct key_store *key_store_import_key (struct key_store *ks,
+ struct key_store_key *key);
extern bool key_store_requires_network (const struct key_store *ks);
extern void free_key_store (struct key_store *ks);

@ -1,4 +1,4 @@
From dd58abc40175f735f6fe2669c34c67e6190e557d Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From e2110f72069f184c87df348247e8f3106c81d44a Mon Sep 17 00:00:00 2001
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

@ -1,119 +0,0 @@
From 54a9e48e5e1088a1b781c30b49bce695007e12fc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 22 May 2023 16:40:21 +0100
Subject: [PATCH] Replace Pervasives.* with Stdlib.*
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since OCaml 4.07 (released 2018-07-10) the always-loaded standard
library module has been called Stdlib. The old Pervasives module was
finally removed in OCaml 5.
$ perl -pi.bak -e 's/Pervasives\./Stdlib./g' -- `git ls-files`
OCaml >= 4.07 is now required.
Also update the common submodule with:
commit d61cd820b49e403848d15c5deaccbf8dd7045370
Author: Jürgen Hötzel
Date: Sat May 20 18:16:40 2023 +0200
Add support for OCaml 5.0
(cherry picked from commit 3cb094083e61203a8751bcf31dcb56a47dec6840)
---
common | 2 +-
daemon/chroot.ml | 2 +-
docs/guestfs-building.pod | 2 +-
generator/pr.ml | 4 ++--
m4/guestfs-ocaml.m4 | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)
Submodule common b636c3f2..d61cd820:
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 0d2fa22f..86b21a7c 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -341,12 +341,12 @@ module List = struct
| x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs
| _ -> invalid_arg "combine3"
- let rec assoc_lbl ?(cmp = Pervasives.compare) ~default x = function
+ let rec assoc_lbl ?(cmp = Stdlib.compare) ~default x = function
| [] -> default
| (y, y') :: _ when cmp x y = 0 -> y'
| _ :: ys -> assoc_lbl ~cmp ~default x ys
- let uniq ?(cmp = Pervasives.compare) xs =
+ let uniq ?(cmp = Stdlib.compare) xs =
let rec loop acc = function
| [] -> acc
| [x] -> x :: acc
diff --git a/daemon/chroot.ml b/daemon/chroot.ml
index 62f387ee..087b5031 100644
--- a/daemon/chroot.ml
+++ b/daemon/chroot.ml
@@ -51,7 +51,7 @@ let f t func arg =
try
let chan = out_channel_of_descr wfd in
output_value chan ret;
- Pervasives.flush chan;
+ Stdlib.flush chan;
Exit._exit 0
with
exn ->
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
index b9bc885a..33703a96 100644
--- a/docs/guestfs-building.pod
+++ b/docs/guestfs-building.pod
@@ -119,7 +119,7 @@ virt tools which are still written in Perl.
I<Required>. Part of Perl core.
-=item OCaml E<ge> 4.04
+=item OCaml E<ge> 4.07
=item OCaml findlib
diff --git a/generator/pr.ml b/generator/pr.ml
index d7e6eba3..ed6e9372 100644
--- a/generator/pr.ml
+++ b/generator/pr.ml
@@ -25,7 +25,7 @@ open Std_utils
open Utils
(* Output channel, 'pr' prints to this. *)
-let chan = ref Pervasives.stdout
+let chan = ref Stdlib.stdout
(* Number of lines generated. *)
let lines = ref 0
@@ -53,7 +53,7 @@ let output_to ?(perm = 0o444) filename k =
chan := open_out filename_new;
k ();
close_out !chan;
- chan := Pervasives.stdout;
+ chan := Stdlib.stdout;
(* Is the new file different from the current file? *)
if Sys.file_exists filename && files_equal filename filename_new then
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index 51072c1a..e850fb8c 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -38,10 +38,10 @@ AC_ARG_ENABLE([ocaml],
[],
[enable_ocaml=yes])
-dnl OCaml >= 4.04 is required.
-ocaml_ver_str=4.04
+dnl OCaml >= 4.07 is required.
+ocaml_ver_str=4.07
ocaml_min_major=4
-ocaml_min_minor=4
+ocaml_min_minor=7
AC_MSG_CHECKING([if OCaml version >= $ocaml_ver_str])
ocaml_major="`echo $OCAMLVERSION | $AWK -F. '{print $1}'`"
ocaml_minor="`echo $OCAMLVERSION | $AWK -F. '{print $2}' | sed 's/^0//'`"

@ -1,4 +1,4 @@
From e42cd859265c34d2013a45b742d4c36bb7617445 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 7ceafac98d3eb28d25195622cb6dc1158e9c1c2f Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From d4fabae17001702894526084bf0ab516de3599d5 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 64c1716c4120e8dc69d0106b6ebcf6ccb9d4fc24 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 6c63f5cd8b43448f4847d550ad313d950d6b8520 Mon Sep 17 00:00:00 2001
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()

@ -1,4 +1,4 @@
From f8e8aef7e9e8334db19529aa46bd28a209436b50 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From cde50cb9d71ffa418f45868aa0d4b874847b989a Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 986f5d8b1110b461d37d044c7a8052ed7ba27f87 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 6e3d91681c7dffdfdf291a809d6773691a2a7bda Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From ec56c62c90d2230e8edcfaaad4517be63f5e2183 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From a55474caa5029c8356957afe36908ee45484ffde Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From e22e17704988b606e24e76160495626552d0845f Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 205e2219b977e70c97ea4b55153d94dc3df91c28 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 055c43fa60c7cefbe3baf32b21cfe8ffae09bf0f Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 0c1d7af8fdbf272f33ccd572ed34923ab094d695 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From d5a52e1004b7b151a1df286a72e49e9766ade2c8 Mon Sep 17 00:00:00 2001
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
@ -43,10 +43,10 @@ index 40a7267e..b350edb5 100644
To find out how to build libguestfs from source, read:
diff --git a/configure.ac b/configure.ac
index d1397f63..f8e5e9bb 100644
index b72e99cf..92479e20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -322,7 +322,7 @@ echo "If any optional component is configured 'no' when you expected 'yes'"
@@ -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:"
@ -87,10 +87,10 @@ index 1e83a9c5..3a03282f 100644
into the libguestfs project.
diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod
index 68cf8292..f0bac9f2 100644
index e1b47ec1..987697b2 100644
--- a/docs/guestfs-hacking.pod
+++ b/docs/guestfs-hacking.pod
@@ -818,7 +818,7 @@ examining the F<tmp/valgrind*> log files carefully.
@@ -804,7 +804,7 @@ examining the F<tmp/valgrind*> log files carefully.
=head2 SUBMITTING PATCHES
Submit patches to the mailing list:

@ -1,4 +1,4 @@
From 64a928f631bc79d885d9822a3022c382cbd5fd55 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 27aca404cfbfdf9b3d155fa0794f86936525f40c Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 9f52ab7794bf54169139995c5296aa5f39e47706 Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From d015c300eb0d6ac1d366cf02b15b7aade7e3063a Mon Sep 17 00:00:00 2001
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

@ -1,4 +1,4 @@
From 335642539772cfee442989f56f1b5d7803e4111c Mon Sep 17 00:00:00 2001
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

@ -0,0 +1,44 @@
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\")

@ -0,0 +1,65 @@
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;

@ -0,0 +1,86 @@
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

@ -0,0 +1,41 @@
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

@ -1,45 +0,0 @@
From edfddf2f6c201461bae29f101ab44462f0151ca6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 10 May 2024 15:23:35 +0100
Subject: [PATCH] daemon: part_get_gpt_type: Remove unhelpful MBR fallback
behaviour
This was an accident of the parted implementation, and wasn't really
used anywhere. Remove it.
(cherry picked from commit 2811e42b436c94392c2722bbf4b19299285a6254)
---
daemon/listfs.ml | 3 ++-
generator/actions_core.ml | 4 +---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
index 2376b61d..4cc3c437 100644
--- a/daemon/listfs.ml
+++ b/daemon/listfs.ml
@@ -111,8 +111,9 @@ and is_partition_can_hold_filesystem partition =
false
else if is_mbr_bogus parttype device partnum then
true
+ else if is_mbr then
+ true
else (
- (* MBR partition id will be converted into corresponding GPT type. *)
let gpt_type = Parted.part_get_gpt_type device partnum in
match gpt_type with
(* Windows Logical Disk Manager metadata partition. *)
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index 26c576c7..faabfdd7 100644
--- a/generator/actions_core.ml
+++ b/generator/actions_core.ml
@@ -8118,9 +8118,7 @@ for a useful list of type GUIDs." };
];
shortdesc = "get the type GUID of a GPT partition";
longdesc = "\
-Return the type GUID of numbered GPT partition C<partnum>. For MBR partitions,
-return an appropriate GUID corresponding to the MBR type. Behaviour is undefined
-for other partition types." };
+Return the type GUID of numbered GPT partition C<partnum>." };
{ defaults with
name = "part_set_gpt_attributes"; added = (1, 21, 1);

@ -7,7 +7,7 @@ set -e
# ./copy-patches.sh
project=libguestfs
rhel_version=9.4
rhel_version=9.5
# Check we're in the right directory.
if [ ! -f $project.spec ]; then

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmP1QzoRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKCAEBAAimQxT37HMWTHOqvj4s6ipOhDCNPlqo4L
z+syvIkgbp024IOPUbrlmSCtrCFiLXsRmmenynFv66N8GXoWmJruyJMyvBxsupZT
lTo7WdCEix/xPh/LAb8Q9RWA2SQYfkOKHRs/gr4b/LbtXBklMlcOdhegx3Mml4SW
gwK5n799YebUVgzYch5hWjHcRAphPaUdMyaJ6MUnFrfUPyGK2QO1yXdnGxkseAPz
srjlhFqu5kNojWzcaNcdHBdKvJVEZo7L6laADRS31sRH0BGVc6/DFJgOPdxROGJe
oeq3Oo1EF88P15NSTNZSXLa65n9kts2OnqRgX/c3njV9+1/JPHJWVM+VezuCcN8D
hHktHVOBjM209N5RmLtR92eROvo1aTrgjsLqOTvwbKBu7NrPc4ZICnX7dMjD6irj
vQz0P5MUmELMvdEN3FMGf45v77z+249e1z+5EGi2HUPKLfxd+I3+2mxUm2xjWOy/
zNzkG2rCgYRB8Tioj6Mw80RYKioRyu8p5lUZvvLk85CJbT4BFH8rXgJbrEBOSunE
lWEcv690GzyszAN8zKZaIqhNzIKdlkQZAd1DMXfNBEfAy23YHRApB1O2EFhNAjAf
yEsUjpiYc0pq64QiCPGzUp4iLfMt9hg4ey5Pquud/j6cfvJ3ak5gZECbFnbUjysZ
YYpwSgy/FVI=
=OPC/
-----END PGP SIGNATURE-----

@ -0,0 +1,17 @@
-----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-----

@ -44,8 +44,8 @@
Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.50.1
Release: 8%{?dist}
Version: 1.50.2
Release: 1%{?dist}
License: LGPLv2+
# Build only for architectures that have a kernel
@ -79,58 +79,56 @@ Source7: libguestfs.keyring
# Maintainer script which helps with handling patches.
Source8: copy-patches.sh
# This is a copy of the common/ submodule from libguestfs @v1.50.1.
# This is a copy of the common/ submodule from libguestfs @v1.50.2.
# We need it because the libguestfs tarball does not include common/
# directories that are not used by libguestfs (eg. common/mlcustomize).
# However the patches (below) patch files in those directories and so
# do not apply properly to the libguestfs tarball. Therefore before
# applying the patches we unpack this in the common/ subdirectory.
Source9: libguestfs-common-1.50.1.tar.gz
Source9: libguestfs-common-1.50.2.tar.gz
# Patches are maintained in the following repository:
# https://github.com/libguestfs/libguestfs/commits/rhel-9.4
# https://github.com/libguestfs/libguestfs/commits/rhel-9.5
# Patches.
Patch0001: 0001-update-common-submodule.patch
Patch0002: 0002-update-common-submodule.patch
Patch0003: 0003-daemon-selinux-relabel-don-t-exclude-selinux-if-it-s.patch
Patch0004: 0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch
Patch0005: 0005-daemon-selinux-relabel-run-setfiles-with-T-0-if-supp.patch
Patch0006: 0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch0007: 0007-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0008: 0008-Remove-virt-dib.patch
Patch0009: 0009-lib-Choose-q35-machine-type-for-x86-64.patch
Patch0010: 0010-RHEL-Revert-build-Remove-bundled-copy-of-ocaml-augea.patch
Patch0011: 0011-update-common-submodule.patch
Patch0012: 0012-LUKS-on-LVM-inspection-test-rename-VGs-and-LVs.patch
Patch0013: 0013-LUKS-on-LVM-inspection-test-test-dev-mapper-VG-LV-tr.patch
Patch0014: 0014-Replace-Pervasives.-with-Stdlib.patch
Patch0015: 0015-fuse-Don-t-call-fclose-NULL-on-error-paths.patch
Patch0016: 0016-ocaml-implicit_close-test-collect-all-currently-unre.patch
Patch0017: 0017-ocaml-Replace-old-enter-leave_blocking_section-calls.patch
Patch0018: 0018-ocaml-Release-runtime-lock-around-guestfs_close.patch
Patch0019: 0019-ocaml-Conditionally-acquire-the-lock-in-callbacks.patch
Patch0020: 0020-ocaml-Fix-guestfs_065_implicit_close.ml-for-OCaml-5.patch
Patch0021: 0021-ocaml-Use-Caml_state_opt-in-preference-to-caml_state.patch
Patch0022: 0022-generator-Add-chown-option-for-virt-customize.patch
Patch0023: 0023-lib-remove-guestfs_int_cmd_clear_close_files.patch
Patch0024: 0024-docs-fix-broken-link-in-the-guestfs-manual.patch
Patch0025: 0025-docs-clarify-sockdir-s-separation.patch
Patch0026: 0026-lib-move-guestfs_int_create_socketname-from-launch.c.patch
Patch0027: 0027-generator-customize-Add-new-StringTriplet-for-use-by.patch
Patch0028: 0028-daemon-lvm-Do-reverse-device-name-translation-on-pvs.patch
Patch0029: 0029-ruby-Replace-MiniTest-with-Minitest.patch
Patch0030: 0030-ruby-Get-rid-of-old-Test-Unit-compatibility.patch
Patch0031: 0031-generator-Sort-virt-customize-options-into-alphabeti.patch
Patch0032: 0032-generator-Add-new-virt-customize-tar-in-operation.patch
Patch0033: 0033-New-mailing-list-email-address.patch
Patch0034: 0034-New-mailing-list-archives.patch
Patch0035: 0035-lib-Include-libxml-parser.h-for-xmlReadMemory.patch
Patch0036: 0036-ocaml-Use-Gc.finalise-instead-of-a-C-finalizer.patch
Patch0037: 0037-ocaml-Nullify-custom-block-before-releasing-runtime-.patch
Patch0038: 0038-Update-common-submodule.patch
Patch0039: 0039-tests-Test-guestfish-key-all-.-selector.patch
Patch0040: 0040-daemon-part_get_gpt_type-Remove-unhelpful-MBR-fallba.patch
Patch0001: 0001-daemon-selinux-relabel-don-t-exclude-selinux-if-it-s.patch
Patch0002: 0002-daemon-selinux-relabel-search-for-invalid-option-in-.patch
Patch0003: 0003-daemon-selinux-relabel-run-setfiles-with-T-0-if-supp.patch
Patch0004: 0004-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch0005: 0005-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0006: 0006-Remove-virt-dib.patch
Patch0007: 0007-lib-Choose-q35-machine-type-for-x86-64.patch
Patch0008: 0008-LUKS-on-LVM-inspection-test-rename-VGs-and-LVs.patch
Patch0009: 0009-LUKS-on-LVM-inspection-test-test-dev-mapper-VG-LV-tr.patch
Patch0010: 0010-fuse-Don-t-call-fclose-NULL-on-error-paths.patch
Patch0011: 0011-ocaml-implicit_close-test-collect-all-currently-unre.patch
Patch0012: 0012-ocaml-Replace-old-enter-leave_blocking_section-calls.patch
Patch0013: 0013-ocaml-Release-runtime-lock-around-guestfs_close.patch
Patch0014: 0014-ocaml-Conditionally-acquire-the-lock-in-callbacks.patch
Patch0015: 0015-ocaml-Fix-guestfs_065_implicit_close.ml-for-OCaml-5.patch
Patch0016: 0016-ocaml-Use-Caml_state_opt-in-preference-to-caml_state.patch
Patch0017: 0017-generator-Add-chown-option-for-virt-customize.patch
Patch0018: 0018-lib-remove-guestfs_int_cmd_clear_close_files.patch
Patch0019: 0019-docs-fix-broken-link-in-the-guestfs-manual.patch
Patch0020: 0020-docs-clarify-sockdir-s-separation.patch
Patch0021: 0021-lib-move-guestfs_int_create_socketname-from-launch.c.patch
Patch0022: 0022-generator-customize-Add-new-StringTriplet-for-use-by.patch
Patch0023: 0023-daemon-lvm-Do-reverse-device-name-translation-on-pvs.patch
Patch0024: 0024-ruby-Replace-MiniTest-with-Minitest.patch
Patch0025: 0025-ruby-Get-rid-of-old-Test-Unit-compatibility.patch
Patch0026: 0026-generator-Sort-virt-customize-options-into-alphabeti.patch
Patch0027: 0027-generator-Add-new-virt-customize-tar-in-operation.patch
Patch0028: 0028-New-mailing-list-email-address.patch
Patch0029: 0029-New-mailing-list-archives.patch
Patch0030: 0030-lib-Include-libxml-parser.h-for-xmlReadMemory.patch
Patch0031: 0031-ocaml-Use-Gc.finalise-instead-of-a-C-finalizer.patch
Patch0032: 0032-ocaml-Nullify-custom-block-before-releasing-runtime-.patch
Patch0033: 0033-Update-common-submodule.patch
Patch0034: 0034-tests-Test-guestfish-key-all-.-selector.patch
Patch0035: 0035-generator-customize.ml-Split-chown-parameter-on-char.patch
Patch0036: 0036-Update-common-submodule.patch
Patch0037: 0037-New-APIs-findfs_partuuid-and-findfs_partlabel.patch
Patch0038: 0038-inspection-Resolve-PARTUUID-and-PARTLABEL-in-etc-fst.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool, gettext-devel
@ -149,8 +147,7 @@ BuildRequires: perl(Pod::Man)
BuildRequires: /usr/bin/pod2text
BuildRequires: po4a
BuildRequires: augeas-devel >= 1.7.0
# Waiting for https://bugzilla.redhat.com/show_bug.cgi?id=2168634
#BuildRequires: ocaml-augeas-devel >= 0.6
BuildRequires: ocaml-augeas-devel >= 0.6
BuildRequires: readline-devel
BuildRequires: xorriso
BuildRequires: libxml2-devel
@ -1144,9 +1141,25 @@ rm ocaml/html/.gitignore
%changelog
* Thu Aug 29 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-8
- daemon: part_get_gpt_type: Remove unhelpful MBR fallback behaviour
resolves: RHEL-56697
* Tue Jul 09 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.2-1
- Update to libguestfs 1.50.2
resolves: RHEL-46775
* Mon Jul 08 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-12
- inspection: Resolve PARTUUID= and PARTLABEL= in /etc/fstab
resolves: RHEL-40142, RHEL-46596
* Fri Jun 28 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-11
- Fix (rare) undetected truncation of 64 bit int results to 32 bits
resolves: RHEL-45466
* Thu Jun 20 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-10
- Remove bundled ocaml-augeas
resolves: RHEL-32142
* Wed Apr 24 2024 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-9
- Add support for nbd+unix:// URIs
resolves: RHEL-33851
* Thu Dec 14 2023 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-7
- Add --key all:... selector
@ -1170,6 +1183,9 @@ rm ocaml/html/.gitignore
- Run SELinux relabelling in parallel [for virt-v2v]
resolves: rhbz#2190276
* Fri Apr 14 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 1:1.48.4-4
- Rebuilt for MSVSphere 9.2 beta
* Fri Dec 02 2022 Richard W.M. Jones <rjones@redhat.com> - 1:1.48.4-4
- New API: guestfs_inspect_get_build_id
- Add support for detecting Windows >= 10, returned through osinfo

Loading…
Cancel
Save