Skip to content

Commit 92d8b42

Browse files
committed
fix(gnokii): use double \\ in [...] for POSIX.1-2024 recommendation
Currently, in POSIX-bracket expressions [...] in the POSIX sed regular expressions, a backslash is treated literally, i.e., a single backslash is enough to include it in the set of characters. However, according to a newly added paragraph "APPLICATION USAGE/p5 - sed - POSIX Issue 8 XCU", POSIX may allow implementations to interpret backslashes in bracket expressions bracket in the future (in a similar way as POSIX awk processes). It recommends using two backslashes in bracket expressions for the future compatibility. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/sed.html#tag_20_109_16
1 parent cacf97b commit 92d8b42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

completions-core/gnokii.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@ _comp_cmd_gnokii()
219219
_comp_compgen -Rv all_cmd help -- --help all
220220

221221
# these 2 below are allowed in combination with others
222+
# Note: POSIX.1-2024 started to recommend using two backslashes \\ in
223+
# bracket expressions [...] in POSIX sed for the future compatibility.
222224
local main_cmd
223225
_comp_split -l main_cmd "$(printf '%s\n' "${all_cmd[@]}" |
224-
command sed -e '/--config/d;/--phone/d;s/[][\(){}|^$*+?.]/\\&/g')"
226+
command sed -e '/--config/d;/--phone/d;s/[][\\(){}|^$*+?.]/\\&/g')"
225227
# don't provide main command completions if one is
226228
# already on the command line
227229
local IFS='|'

0 commit comments

Comments
 (0)