Ubuntu 11.10 bash autocompletion changed
Ever since the release of Ubuntu 11.10 the auto-completion of bash seems to be broken.
whenever you do something like
less /et TAB
then it auto-completes to /etc with an appended space rather then a folder-indicator.
On Launchpad a bug-report was filed against acroread which overwrites the bash completion logic in a particular way but this is apparently not the cause of the problem.
To fix this problem edit /etc/bash_completion and go to line 1587.
sudo vi /etc/bash_completion
At line 1587 you’ll find something similar to:
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps awk bash bc bison cat colordiff cp csplit
curl cut date df diff dir du enscript env expand fmt fold gperf gprof
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir
sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee
texindex touch tr uname unexpand uniq units vdir wc wget who; do
have $i && complete -F _longopt -o default $i
done
unset i
The highlighted piece needs to be changed.
According to the man-pages for bash the -o default will trigger the bash-default behavious which apparently yields different results then expected. This is desribed in the ‘Programmable Completion section’, 16th paragraph.
Thus to fix the problem change the above highlighted part to
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps awk bash bc bison cat colordiff cp csplit
curl cut date df diff dir du enscript env expand fmt fold gperf gprof
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir
sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee
texindex touch tr uname unexpand uniq units vdir wc wget who; do
have $i && complete -F _longopt -o filenames $i
done
unset i
This will cause completions for the commands enumerated in the for-loop to use the correct completion logic.
Dont forget to save the file and restart your bash terminal for this change to become usable.

Comments are closed.