error_print_progname removed at r13641, but sometimes required

Rob McMullen rob.mcmullen at
Wed May 17 10:58:11 UTC 2006

Oh, a wiiiiise guy. :)  Actually, that symbol is only called from
inside the library; in glibc it is dereferenced by error() and
error_at_line() if not NULL to print out a user-defined program name.

There are plenty of other places where there's glibc compatible stubs,
so I thought you'd be interested in why this one was removed even
though putting the symbol back in doesn't cause runtime bugs.  See
patch below.

I understand the dilemma: uClibc advertizes glibc compatibility, but
where do you stop?  If you support every glibc-ism, you'd be just as
bloated as glibc (well, not really, because glibc is horribly crufty,
where uClibc is cleaner).  Full glibc compatibility is not the goal of
uClibc.  But including 4 bytes for a symbol for interface
compatibility seems to be an acceptable trade-off.

The proper solution (to actually get error() and error_at_line() to
print out the program name) requires checking if UCLIBC_HAS___PROGNAME
or UCLIBC_HAS_PROGRAM_INVOCATION_NAME is defined at library configure
time in order to know the program's name.  I'm happy to write a patch
if that's something you'd like.

Personally, I'm just as satisfied with the NOP interface addition
because I don't care that much if an error message prints out the
program name or not.


--- error.c.orig        2006-05-17 06:45:08.000000000 -0400
+++ error.c     2006-05-17 06:45:41.000000000 -0400
@@ -44,7 +44,7 @@
 /* If NULL, error will flush stdout, then print on stderr the program
    name, a colon and a space.  Otherwise, error will call this
    function without parameters instead.  */
-/* void (*error_print_progname) (void) = NULL; */
+void (*error_print_progname) (void) = NULL;

 extern __typeof(error) __error attribute_hidden;
 void __error (int status, int errnum, const char *message, ...)

On 5/16/06, Mike Frysinger <vapier at> wrote:
> On Tuesday 16 May 2006 21:26, Rob McMullen wrote:
> > Working with current svn, and it looks like error_print_progname was
> >
> > removed in this revision:
> > > r13641 | psm | 2006-01-27 14:28:18 -0500 (Fri, 27 Jan 2006) | 1 line
> > >
> > > Disabled NULL error_print_progname, useless
> >
> > but despite it being useless, some programs that check for
> > error_at_line implicitly assume that error_print_progname exists and
> > then fail on linking.
> that's a good thing
> you have a few choices:
>  - add the symbol back in and have runtime bugs
>  - leave the symbol out and have compile bugs
>  - implement the symbol properly
> of the first two choices, the answer is obvious (and is what we're doing
> now) ... as for the third choice, we take patches ;)
> -mike

More information about the uClibc mailing list