Repository navigation
Fix: Replace Perl-compatible \s with POSIX [ \t] in awk expressions for mawk compatibility - #441
Merged
Merged
Conversation
…or mawk compatibility
Owner
|
Hi, Thanks for the write-up, the diagnosis is right and the reasoning is easy to follow. I reproduced the failure and tested both forms against gawk, mawk, the One True Awk and busybox awk, using the exact tab-indented output of #433 proposes the same fix with I'll merge it shortly. |
Antynea
added a commit
that referenced
this pull request
Aug 24, 2026
Since #441 the script no longer uses any gawk-specific awk construct. All of its awk expressions were checked against gawk, mawk, the One True Awk and busybox awk, and run unmodified on all four. Declaring gawk advertised a requirement that the script never enforced and that most users could not satisfy anyway, since mawk is the default awk on Debian, Ubuntu and derivatives. Refs #433, #441
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was done:
Replaced the Perl-compatible regex escape sequence
\swith the POSIX-compliant character class[ \t]in theawkexpressions used to parse the UUID output frombtrfs subvolume show.Why it was done:
Currently, the script uses
\sto match whitespace beforeUUID:in theawkcommand. While GNUawk(gawk) supports PCRE sequences like\s, standard POSIXawkimplementations—most notablymawk, which is the default on Debian, Ubuntu, and their derivatives (like Linux Mint/LMDE)—do not support\s. Whenmawkevaluates/^\s*UUID/, it fails to match the whitespace, returning an empty UUID string. This causes a total failure duringgrub-mkconfigwith the error:UUID of the root subvolume is not available.What it solves:
This change ensures the script correctly identifies the UUID of the root and boot subvolumes on distributions utilizing
mawkas the defaultawkimplementation, preventinggrub-mkconfigfrom crashing.Regression risk:
None. The
[ \t]character class is universally supported by the POSIX regular expression standard. It works flawlessly out-of-the-box on bothgawkandmawk, meaning this fix maintains full backward compatibility with systems that currently use GNUawk, while seamlessly adding support for Debian-based systems.