[Bug 1361404] [NEW] Completion does not work as expected when globbing

Mike Gerow gerow at google.com
Mon Aug 25 22:19:51 UTC 2014


Public bug reported:

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.

** Affects: bash-completion (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  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
  
- # set up dynamic completion loading
+ 1943: # set up dynamic completion loading
  1944: _completion_loader()
  1945: {
  1946:     local compfile=./completions
- 1947:     [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"        
+ 1947:     [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"
  1948:     compfile+="/${1##*/}"
- 1949: 
+ 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.  
+ 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
  
- # set up dynamic completion loading
+ 1943: # set up dynamic completion loading
  1944: _completion_loader()
  1945: {
  1946:     local compfile=./completions
- 1947:     [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"        
+ 1947:     [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"
  1948:     compfile+="/${1##*/}"
- 1949: 
+ 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.  
+ 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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash-completion in Ubuntu.
https://bugs.launchpad.net/bugs/1361404

Title:
  Completion does not work as expected when globbing

Status in “bash-completion” package in Ubuntu:
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1361404/+subscriptions



More information about the foundations-bugs mailing list