Skip to content

Commit 9f60090

Browse files
committed
fix: protect ${a[@]+"${a[@]}"} from IFS in Bash 5.2
In Bash 5.2, when IFS is an empty string, ${a[@]+"${a[@]}"} expands to a single word containing all the elements of the array `a` being joined. We need to ensure IFS being a normal value.
1 parent 7ba4b4a commit 9f60090

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

bash_completion

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,8 @@ _comp__get_cword_at_cursor()
580580
((index < 0)) && index=0
581581
fi
582582

583-
local "$2" "$3" "$4" && _comp_upvars -a${#words[@]} "$2" ${words+"${words[@]}"} \
583+
local IFS=$' \t\n'
584+
local "$2" "$3" "$4" && _comp_upvars -a${#words[@]} "$2" ${words[@]+"${words[@]}"} \
584585
-v "$3" "$cword" -v "$4" "${cur:0:index}"
585586
}
586587

completions/ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
_ri_get_methods()
55
{
6-
local regex
6+
local regex IFS=$' \t\n'
77

88
if [[ $ri_version == integrated ]]; then
99
if [[ ! $separator ]]; then

0 commit comments

Comments
 (0)