Skip to content

Commit a3aab5d

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

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
@@ -3327,7 +3327,7 @@ _comp_load()
33273327
if [[ $rawcmd == \\* ]]; then
33283328
origcmd=${rawcmd:1}
33293329
# If we already have a completion for the "real" command, use it
3330-
$(complete -p -- "$origcmd" 2>/dev/null || echo false) "$rawcmd" && return 0
3330+
eval -- "$(complete -p -- "$origcmd" 2>/dev/null || echo false) \"\$rawcmd\"" && return 0
33313331
fi
33323332
33333333
local cmdname=${origcmd##*/}
@@ -3404,18 +3404,18 @@ _comp_load()
34043404
# $rawcmd contains the raw shell word before processing
34053405
# backslash
34063406
[[ $rawcmd != "$cmd" ]] &&
3407-
eval "$compspec \"\$rawcmd\""
3407+
eval -- "$compspec \"\$rawcmd\""
34083408
# If invoked without path, that one should be set, too
34093409
# ...but let's not overwrite an existing one, if any
34103410
[[ $origcmd != "$cmd" && $origcmd != "$rawcmd" ]] &&
34113411
! complete -p -- "$origcmd" &>/dev/null &&
3412-
eval "$compspec \"\$origcmd\""
3412+
eval -- "$compspec \"\$origcmd\""
34133413
return 0
34143414
fi
34153415
# If not, see if we got one for $cmdname
34163416
if [[ $cmdname != "$cmd" ]] && compspec=$(complete -p -- "$cmdname" 2>/dev/null); then
34173417
# Use that for $cmd too, if we have a full path to it
3418-
[[ $cmd == /* ]] && eval "$compspec \"\$cmd\""
3418+
[[ $cmd == /* ]] && eval -- "$compspec \"\$cmd\""
34193419
return 0
34203420
fi
34213421
# Nothing expected was set, continue lookup

0 commit comments

Comments
 (0)