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.

Algemeen (9)
GlassFish (49)
Java (58)
Managed Services (10)
Oracle (120)
Private Cloud Hosting (2)
SOA/BPEL/ESB (11)
Software development (92)
Strategie (7)
WSO2 (2)

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

  • 071 - 82 000 82
  • Rijndijk 137 | 2394 AG Hazerswoude-Rijndijk
Oracle SOA specialized partner
Java
GlassFish
WSO2
DEMO
i-bridge
Rabobank
Greencat
Jan de Rijk
Reuma Revalidatie Rotterdam
Robeco
VU Medisch Centrum
CHS
LUMC
TomTom
TKP
NCCW
Erasmus MC
UMCG
VIR
ANWB
BVA Auctions
D-Reizen
STEDIN