CommandNotFoundMagic

Differences between revisions 5 and 6
Revision 5 as of 2005-11-07 15:53:40
Size: 1746
Editor: 209
Comment: replace dialog with message
Revision 6 as of 2006-01-01 05:15:17
Size: 1766
Editor: S0106000000cc07fc
Comment: cat spec
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
----
CategorySpec

Summary

The "command not found" message is not very helpful. If e.g. the unzip command is not found but it's available in a package, it would be very interesting if the system could tell that the command is currently not available, but installing a package would provide it.

Rational

Because ubuntu ships only with a single CD some commands that power-users expect are not installed (e.g. gcc, make).

Use cases

  • John sees a tutorial of how to unzip a package using the unzip command, and tries to follow it. The needed package is not installed, so he gets a message saying that installing the mentioned package is needed.

Design

Bash has a "command_not_found" handler that is called in the interactive mode when a command is not found. The first argument is the command that is not found. We hook a custom python script into it that has a database (gdbm or similar) with the available commands as keys and some information (like a list of packages it is in) as value. This lookup needs to be fast. This information is assembled from various sources:

  • from the Content-$arch file
  • from a "by-hand" file to include additonal stuff (like acroread)
  • a mirror with deb that are scanned for update-alternatives commands in

    • postinst

Implementation

The command_not_found handler is in bash, no code for the python script has been written yet..


CategorySpec

CommandNotFoundMagic (last edited 2008-08-06 16:20:46 by localhost)