Skip to content

Commit d60c530

Browse files
committed
fix(curl,qemu): avoid using POSIX character classes for mawk
The POSIX character classes of the form [[:space:]] or [[:lower:]] are not supported by mawk < 1.3.3-20090727. For example, this old version of mawk is still shipped with Ubuntu 18.04 LTS, which offers extended support until 2028-04.
1 parent 3f0322b commit d60c530

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

completions/curl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ _comp_cmd_curl()
105105
--help | -${noargopts}h)
106106
local x categories=(
107107
$("$1" --help non-existent-category 2>&1 |
108-
_comp_awk '/^[[:space:]]/ {print $1}')
108+
_comp_awk '/^[ \t]/ {print $1}')
109109
)
110110
if ((${#categories[@]})); then
111111
for x in "${categories[@]}"; do

completions/qemu

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ _comp_cmd_qemu()
2727
return
2828
;;
2929
-soundhw)
30-
_comp_compgen_split -- "$("$1" -soundhw help |
31-
_comp_awk '/^[[:lower:]]/ {print $1}') all"
30+
_comp_compgen_split -- "$("$1" -soundhw help | _comp_awk '
31+
function islower(s) { return length(s) > 0 && s == tolower(s); }
32+
islower(substr($0, 1, 1)) {print $1}') all"
3233
return
3334
;;
3435
-machine | -M)
35-
_comp_compgen_split -- "$("$1" "$prev" help | _comp_awk \
36-
'/^[[:lower:]]/ {print $1}')"
36+
_comp_compgen_split -- "$("$1" "$prev" help | _comp_awk '
37+
function islower(s) { return length(s) > 0 && s == tolower(s); }
38+
islower(substr($0, 1, 1)) {print $1}')"
3739
return
3840
;;
3941
-cpu)

test/runLint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gitgrep $cmdstart"awk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \
2222
'awk with -F char or -F ERE, use -Fchar instead (Solaris)'
2323

2424
gitgrep $cmdstart"(_comp_)?awk\b.*\[:[a-z]*:\]" \
25-
'awk with POSIX character class not supported in mawk (Debian/Ubuntu)'
25+
'awk with POSIX character class not supported in mawk-1.3.3-20090705 (Debian/Ubuntu)'
2626

2727
gitgrep $cmdstart'sed\b.*\\[?+]' \
2828
'sed with ? or +, use POSIX BRE instead (\{m,n\})'

0 commit comments

Comments
 (0)