[Bash-completion-devel] completion of built-ins redirections & misc

gibboris at gmail.com gibboris at gmail.com
Fri Nov 20 18:05:09 UTC 2009


I didn't dig it enough but it seems
that redirecting the output of some built-ins
(and even commands) seems sometimes broken, eg :
typeset -p > /tm<TAB> [nothing] when it should
append "p/".
(also look at http://bugs.gentoo.org/show_bug.cgi?id=285428)

It happens with 1.0, corrected in the gentoo 1.1 but
happens when I load the trunk what brings me to question
about the way to load trunk :

As BASH_COMPLETION_DIR and 2 more variables are readonly,
I use bash --norc then :
BASH_COMPLETION_DIR=$(pwd)/contrib . ./bash_completion
sed: can't read /etc/bash_completion (twice)
(gentoo only have a /etc/bash_completion.d, shouldn't
it's existence has to be tested ? and/or any better way to
test trunk ?)

Where should the >, >>, >|, &>, ... be handled.
With /bin/ls in trunk a similar issue happens : a space is
appended instead of a slash (I suspect a bad initialisation
of default compopt)
But isn't a opportunity to handle it according to noclobber ?
(if noclobber, then complete with filename when ">>", ">|", otherwise
always complete with filename)

Also note that at the end of bash_completion there is the following :
# source user completion file
[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
    && . ~/.bash_completion
This line is dangerous :
$ cp svn_bashcomp/bash_completion ~/.bash_completion
$ . ~/.bash_completion
[ it never returns : nested loops, ^C forced ]

Shouldn't the the l. 43 :
[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash_completion
reflect both (home and system bash comp) AND avoid the nested loops.
(no simple way as with source there is no information about script name
in $0, $@, ...)
Isn't that one of the role of bash_completion.sh (isn't this file aimed to
be distribution specific).
Also does someone already have looked into the way gentoo splitted
bash_completion{,sh} in to /usr/share/bash_completion/{.pre,.post,base} and
/etc/profile.d/bash_completion.sh to explain me why such a difference with
the vanilla tree (http://gentoo-portage.com/AJAX/Ebuild/97608/View) ?

Last point, while writing BASH_COMPLETION_DIR=$(pwd)/contrib . ./bash_completion
I was thinking about the completion of variable affectation, does someone
already though about a way to use -o filenames for that ?


Raph



More information about the Bash-completion-devel mailing list