mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
bash-completion: fix variable leaks of "IFS" and "word"
Signed-off-by: Koichi Murase <myoga.murase@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
00c0ba5de3
commit
097296c30b
@ -21,7 +21,7 @@ _@command@_complete()
|
||||
# See what URI is user trying to connect to and if they are
|
||||
# connecting RO. Honour that.
|
||||
while [ $c -le $COMP_CWORD ]; do
|
||||
word="${COMP_WORDS[c]}"
|
||||
local word="${COMP_WORDS[c]}"
|
||||
case "$word" in
|
||||
-r|--readonly) RO=1 ;;
|
||||
-c|--connect) c=$((++c)); URI=${COMP_WORDS[c]} ;;
|
||||
@ -56,7 +56,8 @@ _@command@_complete()
|
||||
# the name of the command whose arguments are being
|
||||
# completed.
|
||||
# Therefore, we might just run $1.
|
||||
IFS=$'\n' A=($($1 ${CMDLINE[@]} complete -- "${INPUT[@]}" 2>/dev/null))
|
||||
local IFS=$'\n'
|
||||
A=($($1 ${CMDLINE[@]} complete -- "${INPUT[@]}" 2>/dev/null))
|
||||
|
||||
COMPREPLY=($(compgen -W "${A[*]%--}" -- ${cur}))
|
||||
__ltrim_colon_completions "$cur"
|
||||
|
Loading…
Reference in New Issue
Block a user