Hardy regressions [bash-completion]

Bug #194860 reported by Jürgen Kreileder
44
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Fix Released
Low
Siegfried Gevatter

Bug Description

Binary package hint: bash-completion

Here are some regressions that showed up on Hardy recently.
(Currently using 20060301-1ubuntu1).

===
Support for file names with spaces is broken:

1. Directory example

$ mkdir -p "dir a/dir b/dir c"
$ ls dir[TAB]
=>
$ ls dir\ a/[TAB]
=> Nothing happens. You're stuck there.

2. File example

$ touch "file 1 with spaces in name" "file 2 with spaces in name"
$ ls f[TAB]
=>
$ ls file\ [TAB]
=>
$ls file\\\ [TAB]
=>
$ ls file\\\\\\\ [TAB]
=>
$ ls file\\\\\\\\\\\\\\\ [TAB]
=>
$ ls file\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ [TAB]
and so on... Not very useful.

===
scp host completion is broken:

$ grep "Host homer" ~/.ssh/config
Host homer homer.jknet homer.local
$ scp hom[TAB]
=>
$ scp homer homer.jknet homer.local:

With ssh it works:
$ ssh hom[TAB]
=>
$ ssh homer[TAB]
homer homer.jknet homer.local

===
scp file completion is broken:

Case 1:
This is bit strange. It works like expected from $HOME but not from other directories:

$ cd test
$ scp homer:[TAB]
=>
$ scp homer:
amy amy.jknet amy.local: file\ 1\ with\ spaces\ in\ name
arthur arthur.jknet: file\ 2\ with\ spaces\ in\ name
[...]

Ie. it lists other hosts from ~/.ssh/config and files from pwd.
In older versions it listed the contents of the default directory on the remote host. Much more useful.

Case 2:
Expansion happens on the local host instead of on the remote host.

$ cd
$ ls -d Archive*
Archive/ Archive.test/
$ ssh chaos "ls -d Archive*"
Archive
Archive.nobackup
$ scp chaos:Arch[TAB]
=>
$ scp chaos:Archive[TAB]
=>
$ scp chaos:Archive
Archive/ Archive.test/

Wrong! It should show Archive and Archive.nobackup.

2nd example for that:
$ ls xxx xxy
ls: cannot access xxx: No such file or directory
ls: cannot access xxy: No such file or directory
$ ssh chaos "ls xxx xxy"
xxx
ls: xxy: No such file or directory
$ scp chaos:xx[TAB]
=> nothing happens because completion is done locally
$ touch xxy
$ scp chaos:xx[TAB]
=>
$ scp chaos:xxy

Wrong! xxy is on the local host, not on the remote host.

Revision history for this message
Steve Stalcup (vorian) wrote :

tab complete is not working at all for me on apt-get xyz

Changed in bash-completion:
status: New → Confirmed
Revision history for this message
Mikael Gerdin (mgerdin) wrote :

This problem seems to be because of a change in the file /etc/bash_completion
The change is in almost all completion definitions from:
"cur=${COMP_WORDS[COMP_CWORD]}"
to
"cur=`_get_cword`"
Replacing the /etc/bash_completion with the one from gutsy fixes this for me, and the problem that the fix is supposed to address is something that has never bothered me:
# Get the word to complete
# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
# where the user is completing in the middle of a word.
# (For example, if the line is "ls foobar",
# and the cursor is here --------> ^
# it will complete just "foo", not "foobar", which is what the user wants.)

Revision history for this message
Alex (alexstrabala-deactivatedaccount) wrote :

Could someone attach their gutsy /etc/bash_completion file? Thanks a lot.

Revision history for this message
Mikael Gerdin (mgerdin) wrote :

Attaching working bash_completion file from gutsy

Revision history for this message
Alex (alexstrabala-deactivatedaccount) wrote :

Fix posted by Mikael Gerdin solves the problem. I simply copied the bash_completion file he attached to /etc/bash_completion

sudo cp ~/Desktop/bash_completion /etc/bash_completion

Revision history for this message
Alex Wauck (awauck) wrote :

Bash completion isn't working for me at all in Kubuntu KDE4. It appears that I have no /etc/bash_completion. Why? I have the bash package installed. Attempting to reinstall bash resulted in this:
Writing extended state information... Error!
E: I wasn't able to locate file for the bash package. This might mean you need to manually fix this package.

I'll use the Gutsy bash completion file for now.

Revision history for this message
Alex Wauck (awauck) wrote :

I still don't know what's up with that error, but I fixed my problem by installing the bash-completion package. I guess kubuntu-kde4-desktop does not depend on it.

Revision history for this message
Mika Fischer (zoop) wrote :

The attached debdiff fixes the problem with spaces in filenames while retaining the useful functionality to only complete what's *before* the cursor (this feature introduced the bug).

Revision history for this message
Mika Fischer (zoop) wrote :

I deleted the debdiff above.

The attached debdiff now fixes all the issues in this bug. Please consider sponsoring it.

Revision history for this message
Mika Fischer (zoop) wrote :

And another one with Maintainer set to the MOTU.

Revision history for this message
Mika Fischer (zoop) wrote :

I've put fixed packages into my PPA. To get them put the following into your sources.lists file:

deb http://ppa.launchpad.net/zoop/ubuntu hardy main
deb-src http://ppa.launchpad.net/zoop/ubuntu hardy main

Revision history for this message
Mika Fischer (zoop) wrote :

I've prepared another package that fixes a lot of other ubuntu bugs. The debdiff is attached and it's also in mu PPA. But you can also just download it from http://launchpadlibrarian.net/12688302/bash-completion_20060301-3ubuntu2%7Eppa1_all.deb

Changed in bash-completion:
assignee: nobody → rainct
importance: Undecided → Low
status: Confirmed → In Progress
Revision history for this message
Siegfried Gevatter (rainct) wrote :

Uploaded after merging both debdiff's and adding a mention to the Maintainer change. I haven't tested the changes, please contact me if they cause any new regression.

Thanks for contributing to Ubuntu!

Changed in bash-completion:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash-completion - 20060301-3ubuntu1

---------------
bash-completion (20060301-3ubuntu1) hardy; urgency=low

  * Bug fix upload (LP: #194860)
   - Fixed completion of filenames with spaces
   - Fixed completion of hostnames with scp
   - Fixed completion of filenames with scp
   - Fixed parsing of SSH config files to parse Host and HostName lines
     correctly. Previously "HostName host" lines were parsed as two hosts:
     "Name" and "host".
  * More bugfixes:
   - Fix tar completion to handle "tar rf" the same as "tar cf" (LP: #94407)
   - Complete .m4v and .M4V for media players (LP: #115224)
   - Complete .divx and .flv for media players (LP: #127605)
   - Complete all files for "gzip ... <" (LP: #127605)
   - Allow whitespace in front of GlobalKnownHostsFile etc. (LP: #128866)
   - Complete compressed files for vim (LP: #149494)
   - Always use /etc/hosts and $HOSTFILE for host completion too (LP: #184175)
  * Modify Maintainer value to match the DebianMaintainerField
    specification.

 -- Mika Fischer <email address hidden> Sat, 15 Mar 2008 19:46:17 +0100

Changed in bash-completion:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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