inspection: Resolve PARTUUID= and PARTLABEL= in /etc/fstab
resolves: RHEL-40142, RHEL-46596
This commit is contained in:
parent
a86c5a4fb4
commit
5400e4953a
23
0050-daemon-findfs.ml-Fix-whitespace.patch
Normal file
23
0050-daemon-findfs.ml-Fix-whitespace.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From 2515d69e6c3f32827856014710ffd8af2c0260bb Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 8 Jul 2024 14:37:06 +0100
|
||||
Subject: [PATCH] daemon/findfs.ml: Fix whitespace
|
||||
|
||||
(cherry picked from commit 4c5c0782af0903dff053e758977b49566f7ed096)
|
||||
---
|
||||
daemon/findfs.ml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/daemon/findfs.ml b/daemon/findfs.ml
|
||||
index 09ac0388..cf2ba4a8 100644
|
||||
--- a/daemon/findfs.ml
|
||||
+++ b/daemon/findfs.ml
|
||||
@@ -26,7 +26,7 @@ open Utils
|
||||
let rec findfs_uuid uuid =
|
||||
findfs "UUID" uuid
|
||||
and findfs_label label =
|
||||
- findfs "LABEL"label
|
||||
+ findfs "LABEL" label
|
||||
|
||||
and findfs tag str =
|
||||
(* Kill the cache file, forcing blkid to reread values from the
|
86
0051-New-APIs-findfs_partuuid-and-findfs_partlabel.patch
Normal file
86
0051-New-APIs-findfs_partuuid-and-findfs_partlabel.patch
Normal file
@ -0,0 +1,86 @@
|
||||
From 7c322190a56cebdc70b3e6697020b18f19a8f3d0 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 26c576c7..150cb185 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 16196e11cb791bcac8e6c8c2d8e63235f149cac7 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
|
@ -45,7 +45,7 @@ Summary: Access and modify virtual machine disk images
|
||||
Name: libguestfs
|
||||
Epoch: 1
|
||||
Version: 1.50.1
|
||||
Release: 11%{?dist}
|
||||
Release: 12%{?dist}
|
||||
License: LGPLv2+
|
||||
|
||||
# Build only for architectures that have a kernel
|
||||
@ -140,6 +140,9 @@ Patch0046: 0046-test-data-binaries-Remove-x-attribute.patch
|
||||
Patch0047: 0047-gobject-tests-Don-t-erase-error-messages.patch
|
||||
Patch0048: 0048-daemon-parted-Assume-sfdisk-part-type-exists.patch
|
||||
Patch0049: 0049-generator-daemon-Don-t-truncate-64-bit-results-from-.patch
|
||||
Patch0050: 0050-daemon-findfs.ml-Fix-whitespace.patch
|
||||
Patch0051: 0051-New-APIs-findfs_partuuid-and-findfs_partlabel.patch
|
||||
Patch0052: 0052-inspection-Resolve-PARTUUID-and-PARTLABEL-in-etc-fst.patch
|
||||
|
||||
%if 0%{patches_touch_autotools}
|
||||
BuildRequires: autoconf, automake, libtool, gettext-devel
|
||||
@ -1152,6 +1155,10 @@ rm ocaml/html/.gitignore
|
||||
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user