[PATCH] stdio: Add %m

Rich Felker dalias at aerifal.cx
Tue Jun 13 18:22:35 PDT 2006


On Tue, Jun 13, 2006 at 05:49:58PM -0400, Rob Landley wrote:
> On Tuesday 13 June 2006 5:19 pm, Rich Felker wrote:
> > On Tue, Jun 06, 2006 at 07:22:58PM -0400, Rob Landley wrote:
> > > On Monday 05 June 2006 12:49 pm, Shaun Jackman wrote:
> > > > In particular, busybox uses %m and the maintainers will not accept
> > > > patches converting this format to %s and strerror(errno) due to the
> > > > latter taking more space by making, typically, two additional function
> > > > calls -- one to __errno_location and one to strerror.
> > >
> > > Plus the extra code to load another argument onto the stack.  It adds up.
> > >
> > > Also because although the result looks bad, it isn't a build break or a
> > > loss of functionality in the non-error case.  (Worst case scenario you
> > > just don't see the error details.)
> >
> > Worst case is that printf fails due to invalid format string and does
> > not print anything at all. I've explained before why it's dangerous
> > for printf to continue after encountering an invalid format specifier
> > and thus my implementation returns immediately with error upon
> > encountering one.
> 
> Then yours is broken, we don't work with it, and never will.  (And I don't 
> care.)

Notice that it's also broken (from a bloat standpoint) for printf to
support %m, since that means that linking in printf will also link in
strerror and all the error messages. Even basic hello world app grows
by a significant amount..

Rich



More information about the busybox mailing list