Smarter lib* aware autocompletion?

Bug #546794 reported by Michael Forrest
186
This bug affects 29 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Won't Fix
Medium
Unassigned
Nominated for Maverick by Anders Kaseorg

Bug Description

This patch has lead to serious errors (comments #6, #7) and has clearly never been tested. It should be reverted (debdiff in comment #8).
http://launchpadlibrarian.net/49227213/bash-completion_1.1-3ubuntu3_revert.debdiff

[ORIGINAL DESCRIPTION:]
Binary package hint: apt

Wouldn't it be nice if when typing

apt-get install clu [press tab]

showed libclutter-* etc...

If the autocomplete was just capable of ignoring this common prefix, it would be easier to find a lot of things

:)

Tags: iso-testing
Revision history for this message
Evan (ev) wrote :

Attached is a debdiff that implements this functionality. I'd upload it myself, but I'll defer to mvo or another Ubuntu developer on whether this is worth the delta from Debian.

Ideally, apt-cache pkgnames should take multiple search arguments, to avoid having to make multiple calls to it. For example:
apt-cache --no-generate pkgnames clutter libclutter

For this reason, I'm adding an apt task.

Revision history for this message
Evan (ev) wrote :

Err, leaving the apt task and adding a bash-completion task.

Revision history for this message
Evan (ev) wrote :

Updated fix, given Barry's offline comment that it doesn't work :)

Revision history for this message
Barry Warsaw (barry) wrote :

looks good to me!

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

This bug was fixed in the package bash-completion - 1:1.1-3ubuntu3

---------------
bash-completion (1:1.1-3ubuntu3) maverick; urgency=low

  * Try searching for lib$package on apt-get completion. With this
    change, apt-get install clutter\t completes to apt-get install
    libclutter- (LP: #546794).
 -- Evan Dandrea <email address hidden> Thu, 27 May 2010 16:27:52 +0100

Changed in bash-completion (Ubuntu):
status: New → Fix Released
Revision history for this message
Anders Kaseorg (andersk) wrote :

Ahem. Did anybody test this patch before uploading it? It’s not even valid syntax.

bash: /etc/bash_completion.d/apt: line 32: syntax error near unexpected token `;'
bash: /etc/bash_completion.d/apt: line 32: ` 2> /dev/null ); $( apt-cache --no-generate pkgnames "lib$cur" \'
bash: /etc/bash_completion.d/apt: line 33: syntax error near unexpected token `)'
bash: /etc/bash_completion.d/apt: line 33: ` 2> /dev/null); )'

Changed in bash-completion (Ubuntu):
status: Fix Released → New
Revision history for this message
Anders Kaseorg (andersk) wrote :

Also, I disagree with the premise of the patch. It is wrong for
  apt-get install clutt<TAB>
to complete itself to
  apt-get install libclutter
such that I can’t undo the change by hitting backspace.

If you are looking for libraries, I don’t think typing three characters “lib” is too much to ask.

Please revert this.

Revision history for this message
Anders Kaseorg (andersk) wrote :

Please apply this debdiff to revert the previous patch. Thanks.

summary: - Smarter lib* aware autocompletion?
+ [revert, causes errors] Smarter lib* aware autocompletion?
Revision history for this message
Jimmy Xu (jimmyxu) wrote : Re: [revert, causes errors] Smarter lib* aware autocompletion?

Confirmed the syntax error when bash starts.

bash-completion:
  Installed: 1:1.1-3ubuntu3

Changed in bash-completion (Ubuntu):
status: New → Confirmed
Jimmy Xu (jimmyxu)
Changed in apt (Ubuntu):
status: New → Invalid
Revision history for this message
Adam Conrad (adconrad) wrote :

FWIW, I'd like to "me too" the above sentiments that, even when working correctly, this behavior is incredibly unintuitive to me. I fail to see who it's meant to help, really.

The only people (a tiny subset of users) who would frequently install libraries by hand (rather than as dependencies of binaries or part of a build-dep action) would, I suspect, intersect rather significantly with the subset of users who think it's rather annoying to have to hit ^w and "start over" because hitting tab just changed the beginning of their word.

Anders Kaseorg (andersk)
description: updated
Revision history for this message
zika (4zika4) wrote :

bash: /etc/bash_completion.d/apt: line 32: syntax error near unexpected token `;'
bash: /etc/bash_completion.d/apt: line 32: ` 2> /dev/null ); $( apt-cache --no-generate pkgnames "lib$cur" \'
bash: /etc/bash_completion.d/apt: line 33: syntax error near unexpected token `)'
bash: /etc/bash_completion.d/apt: line 33: ` 2> /dev/null); )'

Any news?

Revision history for this message
zika (4zika4) wrote :

I've copy&paste-ed a piece of code from patch to actual file. It works. But, then, I still get

bash: /etc/bash_completion.d/apt: line 33: syntax error near unexpected token `)'
bash: /etc/bash_completion.d/apt: line 33: ` 2> /dev/null); )'

Of course, if I remove two offending semicolons I get no errors, but, I think that is not the way it is supposed to work... Am I wrong?

Revision history for this message
zika (4zika4) wrote :

When I try given example, I get (after removing ";") (after pressing "Tab"):

~$ apt-get install clu
clustalw libclutter-1.0-dbg
clustalw-mpi libclutter-1.0-dev
clustalx libclutter-1.0-doc
cluster3 libclutter-doc
cluster-agents libcluttergesture-0.0.2-0
cluster-glue libcluttergesture-0.0.2-0-dbg
cluster-glue-dev libcluttergesture-dev
cluster-messaging-framework libclutter-gst-0.10-0
clusterssh libclutter-gst-0.10-dbg
clustlaw libclutter-gst-0.10-dev
clutch libclutter-gst-doc
libclucene0 libclutter-gtk-0.10-0
libclucene0ldbl libclutter-gtk-0.10-dbg
libclucene-dev libclutter-gtk-0.10-dev
libcluceneindex0 libclutter-gtk-0.10-doc
libcluceneindex-dev libclutter-gtk-doc
libcluster-glue libclutter-imcontext-0.1-0
libcluster-glue-dev libclutter-imcontext-0.1-0-dbg
libclutk-0.2-0 libclutter-imcontext-0.1-dev
libclutk-dev libclutter-imcontext-0.1-doc
libclutter-0.1-doc libclutter-perl
libclutter-1.0-0

Is that what I was supposed to get...?

Michael Vogt (mvo)
Changed in bash-completion (Ubuntu):
milestone: none → maverick-alpha-1
importance: Undecided → Medium
Anders Kaseorg (andersk)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash-completion - 1:1.1-3ubuntu4

---------------
bash-completion (1:1.1-3ubuntu4) maverick; urgency=low

  * Revert the patch for LP: #546794 due to an unforseen side effect.
 -- Evan Dandrea <email address hidden> Tue, 01 Jun 2010 08:47:01 +0100

Changed in bash-completion (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Josh Brown (joshbrown) wrote :

I've attached a patch that should fix the original bug without causing any errors.

summary: - [revert, causes errors] Smarter lib* aware autocompletion?
+ Smarter lib* aware autocompletion?
Changed in bash-completion (Ubuntu):
status: Fix Released → New
tags: added: iso-testing
Revision history for this message
Anders Kaseorg (andersk) wrote :

Josh Brown: The behavior of this patch (even with the syntax errors fixed) is not desired. That is why it was reverted. See comments #7 and #10.

Changed in bash-completion (Ubuntu):
status: New → Invalid
Mathew Hodson (mhodson)
no longer affects: apt (Ubuntu)
Changed in bash-completion (Ubuntu):
status: Invalid → Won't Fix
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.