I'm using Bash-it (https://github.com/Bash-it/bash-it) along with bash-complete on Debian Buster, and I get an _xspecs: bad array subscript error whenever I use an alias that uses _filedir_xspec. The original ticket was filed in Bash-it: Bash-it/bash-it#1497
There is an alias
$ alias en
alias en='emacs -nw'
$ complete -p en
complete -F _alias_completion::en en
The _alias_completion::en en is a dynamically generated function by Bash-it (except the echo line, which I added only for debugging purpose and does not affect the bug):
$ type -a _alias_completion\:\:en
_alias_completion::en is a function
_alias_completion::en ()
{
(( COMP_CWORD += 1 ));
COMP_WORDS=(emacs -nw ${COMP_WORDS[@]:1});
(( COMP_POINT -= ${#COMP_LINE} ));
COMP_LINE=${COMP_LINE/en/emacs -nw};
(( COMP_POINT += ${#COMP_LINE} ));
echo [${COMP_LINE}][${COMP_CWORD}][${COMP_POINT}][${COMP_TYPE}][${COMP_KEY}][${COMP_WORDS[@]}] 1>&2;
_filedir_xspec
}
When I use TAB after typing som to open the file named somefile, I get this:
$ en som[emacs -nw som][2][13][9][9][emacs -nw som]
bash: _xspecs: bad array subscript
efile
Note that the completion actually seems to be working (see efile following the error message), but it outputs bash: _xspecs: bad array subscript upon hitting TAB. The parameters that I echo in square brackets seem to make sense to me (though I am not actually familiar with COMP_* variables).
I am wondering if this is a bug in bash-completion.
I'm using Bash-it (https://github.com/Bash-it/bash-it) along with bash-complete on Debian Buster, and I get an
_xspecs: bad array subscripterror whenever I use an alias that uses_filedir_xspec. The original ticket was filed in Bash-it: Bash-it/bash-it#1497There is an alias
The
_alias_completion::en enis a dynamically generated function by Bash-it (except theecholine, which I added only for debugging purpose and does not affect the bug):When I use
TABafter typingsomto open the file namedsomefile, I get this:Note that the completion actually seems to be working (see
efilefollowing the error message), but it outputsbash: _xspecs: bad array subscriptupon hittingTAB. The parameters that I echo in square brackets seem to make sense to me (though I am not actually familiar withCOMP_*variables).I am wondering if this is a bug in bash-completion.