Skip to content

Commit 5fe98f3

Browse files
committed
fix(_comp_compgen): explicitly exclude cur from the target variable
1 parent dfce675 commit 5fe98f3

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
@@ -420,8 +420,8 @@ _comp_compgen__error_fallback()
420420
# -a Append to the array
421421
# -v arr Store the results to the array ARR. The default is `COMPREPLY`.
422422
# The array name should not start with an underscores "_", which is
423-
# internally used. The array name should not be either "IFS" or
424-
# "OPT{IND,ARG,ERR}".
423+
# internally used. The array name should not be any of "cur", "IFS"
424+
# or "OPT{IND,ARG,ERR}".
425425
# -U var Unlocalize VAR before performing the assignments. This option can
426426
# be specified multiple times to register multiple variables. This
427427
# option is supposed to be used in implementing a generator (G1) when
@@ -538,7 +538,7 @@ _comp_compgen()
538538
case $_opt in
539539
a) _append=set ;;
540540
v)
541-
if [[ $OPTARG == @(*[^_a-zA-Z0-9]*|[0-9]*|''|_*|IFS|OPTIND|OPTARG|OPTERR) ]]; then
541+
if [[ $OPTARG == @(*[^_a-zA-Z0-9]*|[0-9]*|''|_*|IFS|OPTIND|OPTARG|OPTERR|cur) ]]; then
542542
printf 'bash_completion: %s: -v: invalid array name `%s'\''\n' "$FUNCNAME" "$OPTARG" >&2
543543
return 2
544544
fi
@@ -548,7 +548,7 @@ _comp_compgen()
548548
if [[ $OPTARG == @(*[^_a-zA-Z0-9]*|[0-9]*|'') ]]; then
549549
printf 'bash_completion: %s: -U: invalid variable name `%s'\''\n' "$FUNCNAME" "$OPTARG" >&2
550550
return 2
551-
elif [[ $OPTARG == @(_*|IFS|OPTIND|OPTARG|OPTERR) ]]; then
551+
elif [[ $OPTARG == @(_*|IFS|OPTIND|OPTARG|OPTERR|cur) ]]; then
552552
printf 'bash_completion: %s: -U: unnecessary to mark `%s'\'' as upvar\n' "$FUNCNAME" "$OPTARG" >&2
553553
return 2
554554
fi

0 commit comments

Comments
 (0)