moreutils: an 'errno' utility
Tim Chavez
timrchavez at gmail.com
Thu Aug 26 16:34:08 BST 2010
Hi Soren,
On Thu, Aug 26, 2010 at 3:52 AM, Soren Hansen <soren at ubuntu.com> wrote:
> I've been using MySQL's perror(1) util for this for years, but being
> able to search through the error messages is pretty neat, so for giggles
> I wrote a version of it in Python that does not depend on dev headers of
> any kind being installed. I put it in this branch:
>
> lp:~soren/ubuntu-dev-tools/py-errno
>
> You can see the code directly here:
>
>
> http://bazaar.launchpad.net/~soren/ubuntu-dev-tools/py-errno/annotate/head%3A/errno
>
> I'm not sure what's going on with the syntax highlighting on that page,
> though. Maybe it still thinks it's bash.
>
> Anyways, going this route for moreutils would make it grow a python
> dependency which I somehow doubt is desirable. It's not rocket science,
> though. It should be easily portable to perl.
>
> --
> Soren Hansen
> Ubuntu Developer
> http://www.ubuntu.com/
Also, the 'errno' Python module has an incomplete mapping.
Specifically, it is missing:
ENOMEDIUM 123 /* No medium found */
EMEDIUMTYPE 124 /* Wrong medium type */
ECANCELED 125 /* Operation Canceled */
ENOKEY 126 /* Required key not available */
EKEYEXPIRED 127 /* Key has expired */
EKEYREVOKED 128 /* Key has been revoked */
EKEYREJECTED 129 /* Key was rejected by service */
EOWNERDEAD 130 /* Owner died */
ENOTRECOVERABLE 131 /* State not recoverable */
ERFKILL 132 /* Operation not possible due to RF-kill */
(output generated by Dustin's version)
I only know this because I hacked out a version of this program last
night as well :) My spin on this program was to only take an error
number or a range of error numbers as input and then output the
translation(s). The program supports an open-ended range (e.g. 1:)
which will return translations for all error numbers. The user can
then apply search terms via grep to find what they're looking for.
Anyway,
fluxcrank:~$ ./errno 5:15
5 EIO Input/output error
6 ENXIO No such device or address
7 E2BIG Argument list too long
8 ENOEXEC Exec format error
9 EBADF Bad file descriptor
10 ECHILD No child processes
11 EAGAIN Resource temporarily unavailable
12 ENOMEM Cannot allocate memory
13 EACCES Permission denied
14 EFAULT Bad address
15 ENOTBLK Block device required
Warning: My version uses string.format() which I believe requires >= Python 2.6
--
-tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: errno
Type: application/octet-stream
Size: 1736 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20100826/38ce059f/attachment-0001.obj
More information about the ubuntu-devel
mailing list