libguestfs/0006-inspection-Resolve-PARTUUID-and-PARTLABEL-in-etc-fst.patch
Richard W.M. Jones 542623f737 Synchronize patches with RHEL 9.5
resolves: RHEL-56325
2024-08-28 10:00:12 +01:00

46 lines
1.8 KiB
Diff

From 5733e5268fe0b7a99f20b23ea30ab13632cc9d95 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)
(cherry picked from commit ebce03824a3ce75823037003ca2311d7b8d61565)
---
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 837c8c620..f5817a318 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
--
2.43.0