Smarter lib* aware autocompletion?

Bug #546794 reported by Michael Forrest on 2010-03-25
186
This bug affects 29 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
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

:)

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.

Evan (ev) wrote :

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

Evan (ev) wrote :

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

Barry Warsaw (barry) wrote :

looks good to me!

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
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
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.

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?

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) on 2010-05-28
Changed in apt (Ubuntu):
status: New → Invalid
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) on 2010-05-29
description: updated
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?

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?

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) on 2010-05-31
Changed in bash-completion (Ubuntu):
milestone: none → maverick-alpha-1
importance: Undecided → Medium
Anders Kaseorg (andersk) on 2010-05-31
description: updated
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
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
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
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  Edit
Everyone can see this information.

Other bug subscribers