From d83c4be5ed4b2effa8487c084f9b1e99200ea7e5 Mon Sep 17 00:00:00 2001 From: Reynegton Pinheiro Nunes <68282012+reynegton@users.noreply.github.com> Date: Mon, 24 Aug 2026 09:46:18 -0300 Subject: [PATCH] fix: use portable whitespace matching in awk UUID parsing (#441) The awk expressions parsing `btrfs subvolume show` used `\s`, a GNU extension. mawk and the One True Awk treat it as a literal `s`, so `/^\s*UUID/` never matches a tab-indented line and the UUID comes back empty. Since `awk` is mawk by default on Debian, Ubuntu and derivatives, grub-mkconfig aborted there with "UUID of the root subvolume is not available". Replace `\s` with `[ \t]`, which every awk implementation supports and which matches the notation already used by the gsub on the same line. Closes #425 --- 41_snapshots-btrfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 20e7baa..49cc0df 100755 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -134,7 +134,7 @@ fi # Root subvolume UUID root_uuid_subvolume="$(btrfs subvolume show / 2>/dev/null | \ - awk -F':' '/^\s*UUID/ {gsub(/^[ \t]+/, "", $2); print $2}')" + awk -F':' '/^[ \t]*UUID/ {gsub(/^[ \t]+/, "", $2); print $2}')" [ -z "$root_uuid_subvolume" ] && print_error "UUID of the root subvolume is not available" # ---------- Boot partition ---------- @@ -150,7 +150,7 @@ fi # If /boot is not a Btrfs subvolume, reuse root subvol UUID boot_uuid_subvolume="$( btrfs subvolume show "${boot_directory}" 2>/dev/null | \ - awk -F':' '/^\s*UUID/ {gsub(/^[ \t]+/, "", $2); print $2; exit}' + awk -F':' '/^[ \t]*UUID/ {gsub(/^[ \t]+/, "", $2); print $2; exit}' )" [ -z "$boot_uuid_subvolume" ] && boot_uuid_subvolume="$root_uuid_subvolume"