The PATH expansion done in `_root_command()':
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
stayed effective with bash >= 4.1.4 running in posix mode, causing PATH to grow
ever larger when doing sudo completions. This is now fixed.
To run the automated test:
./run ./completion/sudo.exp
See also:
- http://www.mail-archive.com/bug-bash@gnu.org/msg06942.html
- bash patch: bash41-004
Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES]
Available VARNAMES:
cur Return cur within varname "cur"
prev Return prev within varname "prev"
words Return words within varname "words"
cword Return cword within varname "cword"
Available OPTIONS:
-n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT be
considered word breaks. This is useful for things like scp
where we want to return host:path and not only path, so we
would pass the colon (:) as -n option in this case. Bash-3
doesn't do word splitting, so this ensures we get the same
word on both bash-3 and bash-4.
-c VARNAME Return cur within specified VARNAME
-p VARNAME Return prev within specified VARNAME
-w VARNAME Return words within specified VARNAME
-i VARNAME Return words within specified VARNAME
Example usage:
$ _get_comp_words_by_ref -n : cur prev
regardless of $cur beginning with ' or not"), because this is failing
tests:
FAIL: completing f a\'b/ should return i
FAIL: completing f a\"b/ should return i
FAIL: f a\$b/ should show completions
FAIL: f a\\b/ should show completions
FAIL: completing f2 a\'b/ should return i
FAIL: completing f2 a\"b/ should return i
FAIL: f2 a\$b/ should show completions
FAIL: f2 a\\b/ should show completions
- Fix _filedir to check for availability of COMP_WORDS (_filedir runs from
within a completion instead of the command line) when doing a `complete -p
${COMP_WORDS[0]'
- Fix _filedir usage comment
- Enhanced _filedir tests
- Added _filedir test "completing with filter '.e1' should show completions"
This can be triggered when $cur is actually empty, like, for example, when _filedir
is manually launched from the command line:
$ _filedir in
$ echo ${COMPREPLY[@]}
test doc .git contrib
i.e. it's only showing the directories, not showing the files we're looking for.
After this commit:
$ . bash_completion
$ _filedir in
$ echo ${COMPREPLY[@]}
test doc .git contrib bash_completion.sh.in Makefile.in
$
Which is the expected behaviour.