Bash Smart Completion expands to one file instead of all when using whildcards

Bug #1310855 reported by Daniel
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Using Bash Smart Completion, I found that sometimes when I use wildcards and then press tab, not all existing files are consideres for expansion but only the first one. This is a very dangerous behaviour because people tend to think there is only one file matching the pattern.

Steps to reproduce (bash shell with smart completion enabled):

1. Create files a.x and b.x
    $ touch a.x
    $ touch b.x
2. Enter "ls *x" (without quotes)
3. Press tab
4.
    Expected: Shell doesn't expand because there are two files matching the pattern
    Instead, the shell expands to "ls a.x"

Shell 'screenshot', to show the difference:

$ # smart completion is enabled
$ touch a.x # create test files
$ touch b.x
$ ls *.x<tab>
$ ls a.x # shell expanded *.x to a.x

You can simply reproduce the expected behavoiur when you disable smart completion:

$ complete -r #disable smart completion
$ touch a.x # create test files
$ touch b.x
$ ls *.x<tab><tab>
a.x b.x
$ ls *.x

My System:

Ubuntu 14.04 LTS with current updates
Linux 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

bash --version
GNU bash, version 4.3.8(1)-release (x86_64-pc-linux-gnu)

Package: bash
Architecture: amd64
Version: 4.3-6ubuntu1

Package: bash-completion
Architecture: all
Version: 1:2.1-4

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in bash (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.