From 09155de386c9b998c37b29bce3c19663dd2fcf96 Mon Sep 17 00:00:00 2001 From: Hannes Laimer Date: Mon, 25 Nov 2024 17:22:13 +0100 Subject: [PATCH] api: disks: only return UUID of partitions if it actually is one Some filesystems like FAT don't include a concept of UUIDs. Instead, tools like blkid tools like blkid derive these identifiers based on certain filesystem metadata, such as volume serial numbers or other unique information. This does however not follow the format specified in RFC 9562[1]. [1] https://datatracker.ietf.org/doc/html/rfc9562 Signed-off-by: Hannes Laimer --- src/tools/disks/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs index 6345fde7..61aceccd 100644 --- a/src/tools/disks/mod.rs +++ b/src/tools/disks/mod.rs @@ -898,7 +898,10 @@ fn get_partitions_info( let mut uuid = None; if let Some(devpath) = devpath.as_ref() { for info in lsblk_infos.iter().filter(|i| i.path.eq(devpath)) { - uuid = info.uuid.clone(); + uuid = info + .uuid + .clone() + .filter(|uuid| pbs_api_types::UUID_REGEX.is_match(uuid)); used = match info.partition_type.as_deref() { Some("21686148-6449-6e6f-744e-656564454649") => PartitionUsageType::BIOS, Some("c12a7328-f81f-11d2-ba4b-00a0c93ec93b") => PartitionUsageType::EFI,