Completion does not work as expected when globbing

Bug #1361404 reported by Mike Gerow
This bug report is a duplicate of:  Bug #1387057: wildcard incorrect completion. Edit Remove
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Ubuntu 14.04.1 LTS
2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
2.1-4
3) What you expected to happen
When I type in bash:
> ls ~/.bash*<Tab><Tab>
I expected to see completions like
.bash_history .bash_logout .bashrc
4) What happened instead
Nothing happens, I get no completions.

In another case if I have a bunch of .deb files in my current directory I would expect:

> ls *.deb<Tab><Tab>

To suggest something like:

bash-completion_2.1-4_all.deb my-other-package_128.deb

But it does not.

I can add a line like this to my .bashrc:

compopt -o bashdefault ls

And it will make it to where globbing completion works for ls, but not for every other command. In order to do so I have to modify my /usr/share/bash-completion/bash_completion and change line 1954 from

1943: # set up dynamic completion loading
1944: _completion_loader()
1945: {
1946: local compfile=./completions
1947: [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"
1948: compfile+="/${1##*/}"
1949:
1950: # Avoid trying to source dirs; https://bugzilla.redhat.com/903540
1951: [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
1952:
1953: # Need to define *something*, otherwise there will be no completion at all.
1954: complete -F _minimal "$1" && return 124
1955: } &&
1956: complete -D -F _completion_loader

to

1943: # set up dynamic completion loading
1944: _completion_loader()
1945: {
1946: local compfile=./completions
1947: [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"
1948: compfile+="/${1##*/}"
1949:
1950: # Avoid trying to source dirs; https://bugzilla.redhat.com/903540
1951: [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
1952:
1953: # Need to define *something*, otherwise there will be no completion at all.
1954: complete -F _minimal -o bashdefault "$1" && return 124
1955: } &&
1956: complete -D -F _completion_loader

This will be overwritten when I upgrade bash-completion, though.

Mike Gerow (gerow)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bash-completion (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.