Skip to content

Commit f7d0557

Browse files
committed
fix(_comp_load): work around custom IFS, word splitting, and failglob
1 parent 097fbe5 commit f7d0557

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bash_completion

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,7 +3258,7 @@ _comp_load()
32583258
if [[ $rawcmd == \\* ]]; then
32593259
origcmd=${rawcmd:1}
32603260
# If we already have a completion for the "real" command, use it
3261-
$(complete -p -- "$origcmd" 2>/dev/null || echo false) "$rawcmd" && return 0
3261+
eval -- "$(complete -p -- "$origcmd" 2>/dev/null || echo false) \"\$rawcmd\"" && return 0
32623262
fi
32633263
32643264
local cmdname=${origcmd##*/}
@@ -3335,18 +3335,18 @@ _comp_load()
33353335
# $rawcmd contains the raw shell word before processing
33363336
# backslash
33373337
[[ $rawcmd != "$cmd" ]] &&
3338-
eval "$compspec \"\$rawcmd\""
3338+
eval -- "$compspec \"\$rawcmd\""
33393339
# If invoked without path, that one should be set, too
33403340
# ...but let's not overwrite an existing one, if any
33413341
[[ $origcmd != "$cmd" && $origcmd != "$rawcmd" ]] &&
33423342
! complete -p -- "$origcmd" &>/dev/null &&
3343-
eval "$compspec \"\$origcmd\""
3343+
eval -- "$compspec \"\$origcmd\""
33443344
return 0
33453345
fi
33463346
# If not, see if we got one for $cmdname
33473347
if [[ $cmdname != "$cmd" ]] && compspec=$(complete -p -- "$cmdname" 2>/dev/null); then
33483348
# Use that for $cmd too, if we have a full path to it
3349-
[[ $cmd == /* ]] && eval "$compspec \"\$cmd\""
3349+
[[ $cmd == /* ]] && eval -- "$compspec \"\$cmd\""
33503350
return 0
33513351
fi
33523352
# Nothing expected was set, continue lookup

0 commit comments

Comments
 (0)