moreutils: an 'errno' utility

Dustin Kirkland kirkland at ubuntu.com
Wed Aug 25 15:28:42 BST 2010


On Sat, Aug 21, 2010 at 6:58 AM, Joey Hess <joey at kitenet.net> wrote:
> Dustin Kirkland wrote:
>> I have contributed a small utility (and manpage) called "errno" to
>> Debian/Ubuntu's ubuntu-dev-tools package.  Several people have
>> suggested [1] that this utility might have a better home in your
>> moreutils project.  I didn't originally submit it to moreutils because
>> most of those tools appear to do their work on stdin.
>
> That is not a criteria for moreutils; doing something generally useful that
> cannot be accomplished with standard unix tools is the only criteria.

Cool, thanks for the clarification.

>> In any case, it's a ~10 line shell script that takes one or more
>> strings on the command line, and looks for a matching POSIX error
>> codes, error names, or error descriptions.  It's useful, as a
>> developer on a command line, to work your way to and from error tuples
>> of codes/names/descriptions.  People have suggested rewriting it in
>> Python, which can be done easily.  And many, many people have written
>> their own grep hacks to do the same [2].
>
> This is a good idea, but the implementation leaves something to be
> desired, since it requires gcc and libc headers.
>
> Couldn't a C program use sys_errlist[]? (see perror(3))

Almost, but not trivially with complete feature parity.  The current
"grep" implementation allows searching on any of the 3-tuple, of an
error code's [number, name, description].

The updated, attached script opportunistically uses gcc, but does not
require it, as it falls back to using the
/usr/include/asm-generic/errno*.h headers.

Perhaps this version is acceptable to you.  If not, no big deal -- it
has been added to the ubuntu-dev-tools package for now (until it finds
a better home), so I'm happy.  Thanks.

Cheers,
:-Dustin



More information about the ubuntu-devel mailing list