From 0a296c1808200072deea6285f3e9992fca6095dd Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 7 Jan 2023 23:19:18 -0500 Subject: [PATCH] gen-options.awk: Work around busybox regex bug. It appears that busybox awk does not recognize \] in a character class, interpreting the backslash literally and taking the ] as the end of the character class: % printf '%s\n' ']' '\]' | busybox awk '/^[\]]$/ { print; }' \] % printf '%s\n' ']' '\]' | gawk '/^[\]]$/ { print; }' ] Busybox does accept []] as meaning "] is part of the character class", but this syntax is not portable to heirloom (and presumably also Solaris 10) awk, which only works with [\]]. GNU awk accepts either form. So instead, let's avoid this problematic construct entirely by writing the test in a different way. --- scripts/gen-options.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen-options.awk b/scripts/gen-options.awk index f1dbb1c..a93c47c 100755 --- a/scripts/gen-options.awk +++ b/scripts/gen-options.awk @@ -152,7 +152,7 @@ $0 ~ /^-/ { } # Extract argument name - if (work ~ /^\[=[^\] \t]+\]/) { + if (work ~ /^\[=[^ \t]+\]/ && sub(/\]/, "&", work) == 1) { if (n = index(work, "]")) { arg = substr(work, 3, n-3) work = substr(work, n+1) -- 2.43.2