Skip to content

Commit

Permalink
fix(curl,qemu): avoid using POSIX character classes for mawk
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
akinomyoga committed Nov 28, 2023
1 parent 3f0322b commit d60c530
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion completions/curl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ _comp_cmd_curl()
--help | -${noargopts}h)
local x categories=(
$("$1" --help non-existent-category 2>&1 |
_comp_awk '/^[[:space:]]/ {print $1}')
_comp_awk '/^[ \t]/ {print $1}')
)
if ((${#categories[@]})); then
for x in "${categories[@]}"; do
Expand Down
10 changes: 6 additions & 4 deletions completions/qemu
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ _comp_cmd_qemu()
return
;;
-soundhw)
_comp_compgen_split -- "$("$1" -soundhw help |
_comp_awk '/^[[:lower:]]/ {print $1}') all"
_comp_compgen_split -- "$("$1" -soundhw help | _comp_awk '
function islower(s) { return length(s) > 0 && s == tolower(s); }
islower(substr($0, 1, 1)) {print $1}') all"
return
;;
-machine | -M)
_comp_compgen_split -- "$("$1" "$prev" help | _comp_awk \
'/^[[:lower:]]/ {print $1}')"
_comp_compgen_split -- "$("$1" "$prev" help | _comp_awk '
function islower(s) { return length(s) > 0 && s == tolower(s); }
islower(substr($0, 1, 1)) {print $1}')"
return
;;
-cpu)
Expand Down
2 changes: 1 addition & 1 deletion test/runLint
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gitgrep $cmdstart"awk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \
'awk with -F char or -F ERE, use -Fchar instead (Solaris)'

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

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

0 comments on commit d60c530

Please sign in to comment.