Can't search database if a command is on PATH

Bug #486716 reported by John Lee
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
command-not-found
Won't Fix
Wishlist
Unassigned
command-not-found (Ubuntu)
Invalid
Wishlist
Unassigned

Bug Description

Binary package hint: command-not-found

If a command is already installed by some package, there's no way to search command-not-found's database (short of some sort of PATH hack). Searching the database would be a handy way to find out what package provides that command, along with what other packages provide identically-named commands. It's also possible to do some of that using dpkg -S, but that only works if the command *is* installed by some package, and it uses a different database, and it doesn't list other packages that provide identically-named commands, and it's slow.

The attached patch adds a new command "packages-providing" that prints a two-column list listing package names and components that provide the named command -- e.g.:

$ packages-providing alien
alien main

The patch also changes one line of code to not crash on x86_64 architecture.

This isn't yet properly tested, since I found the database building code seems broken: is that a known issue? I tested as far as hacking the code a bit to get myself a tiny database, building and installing the package, and seeing that "packages-providing alien" printed what I expected. Can I get a pre-built database that's compatible with bzr command-not-found from somewhere?

Patch is against bzr revision 71.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.10
Release: 9.10
Codename: karmic

Revision history for this message
John Lee (jjl) wrote :
tags: added: patch
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport and your patch.

It is possible (also currently pretty difficult) to search the c-n-f database for installed packages. Here is a example:

$ /usr/lib/command-not-found --ignore-installed alien
The program 'alien' is currently not installed. You can install it by typing:
sudo apt-get install alien
alien: command not found

Having a simpler way is probably a good idea. If you are interessted on working on this I would suggest to start
with the lp:~ubuntu-core-dev/command-not-found/ubuntu branch as the 0.3 branch is currently not planned to
land for lucid. I would also suggest to use a slightly less generic name like "packages-provides-command".

For quickest turn-around for patches, its probably best to use irc (I'm "mvo" on freenode) or mail me patches
directly :)

Cheers,
Michael

Michael Vogt (mvo)
Changed in command-not-found (Ubuntu):
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I'll port and integrate that patch.

It will be available in the next release.

Changed in command-not-found:
status: New → Confirmed
importance: Undecided → Wishlist
assignee: nobody → Zygmunt Krynicki (zkrynicki)
milestone: none → 0.2.42
Zygmunt Krynicki (zyga)
Changed in command-not-found:
status: Confirmed → In Progress
David Futcher (bobbo)
tags: added: patch-accepted-upstream
removed: patch
Zygmunt Krynicki (zyga)
Changed in command-not-found:
status: In Progress → Confirmed
Zygmunt Krynicki (zyga)
Changed in command-not-found:
assignee: Zygmunt Krynicki (zkrynicki) → nobody
Revision history for this message
Dominique Ramaekers (dominique-ramaekers) wrote :

It seems this function never got to the ubuntu-core-dev code.

On issuing:

$ /usr/lib/command--not-found --help

The c-n-f gives a help message with a clear description of how to use --ignore-installed.

It's a pity of Zygmunts work but it seems nobody really misses the 'easier' way.

For the 'x86_64 crash', I think in version 0.3, it's not an issue.

I'm changing the status in won't fix...

Changed in command-not-found:
status: Confirmed → Won't Fix
Changed in command-not-found (Ubuntu):
status: Confirmed → Invalid
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.