From eb98ddd8b8d522c9de8fb30c0915d254b5e5b853 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 28 Nov 2025 16:56:11 +0000 Subject: [PATCH] sysupdate: also mention patterns to match in error log on failure The gpt uuid is not the only thing that needs to match, the pattern does as well, so mention it in the error log if present --- src/sysupdate/sysupdate-transfer.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/sysupdate/sysupdate-transfer.c b/src/sysupdate/sysupdate-transfer.c index cb57d4af093..66a4d3d5106 100644 --- a/src/sysupdate/sysupdate-transfer.c +++ b/src/sysupdate/sysupdate-transfer.c @@ -769,21 +769,32 @@ int transfer_vacuum( limit = instances_max - space; if (t->target.type == RESOURCE_PARTITION && space != UINT64_MAX) { + _cleanup_free_ char *patterns = NULL; uint64_t rm, remain; + patterns = strv_join(t->target.patterns, "|"); + if (!patterns) + (void) log_oom_debug(); + /* If we are looking at a partition table, we also have to take into account how many * partition slots of the right type are available */ if (t->target.n_empty + t->target.n_instances < 2) return log_error_errno(SYNTHETIC_ERRNO(ENOSPC), - "Partition table has less than two partition slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s), refusing.", + "Partition table has less than two partition slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s)%s%s%s, refusing.", SD_ID128_FORMAT_VAL(t->target.partition_type.uuid), - gpt_partition_type_uuid_to_string(t->target.partition_type.uuid)); + gpt_partition_type_uuid_to_string(t->target.partition_type.uuid), + !isempty(patterns) ? " and matching the expected pattern '" : "", + strempty(patterns), + !isempty(patterns) ? "'" : ""); if (space > t->target.n_empty + t->target.n_instances) return log_error_errno(SYNTHETIC_ERRNO(ENOSPC), - "Partition table does not have enough partition slots of right type " SD_ID128_UUID_FORMAT_STR " (%s) for operation.", + "Partition table does not have enough partition slots of right type " SD_ID128_UUID_FORMAT_STR " (%s)%s%s%s for operation.", SD_ID128_FORMAT_VAL(t->target.partition_type.uuid), - gpt_partition_type_uuid_to_string(t->target.partition_type.uuid)); + gpt_partition_type_uuid_to_string(t->target.partition_type.uuid), + !isempty(patterns) ? " and matching the expected pattern '" : "", + strempty(patterns), + !isempty(patterns) ? "'" : ""); if (space == t->target.n_empty + t->target.n_instances) return log_error_errno(SYNTHETIC_ERRNO(ENOSPC), "Asked to empty all partition table slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s), can't allow that. One instance must always remain.", -- 2.47.3