Bash Smart Completion expands to one file instead of all when using whildcards
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-
Package: bash
Architecture: amd64
Version: 4.3-6ubuntu1
Package: bash-completion
Architecture: all
Version: 1:2.1-4
Status changed to 'Confirmed' because the bug affects multiple users.