[patch] coreutils/printf.c
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Sat May 31 17:10:12 UTC 2008
On Sat, 31 May 2008, Denys Vlasenko wrote:
> On Friday 30 May 2008 12:25, Cristian Ionescu-Idbohrn wrote:
> > On Fri, 30 May 2008, Bernhard Fischer wrote:
> >
> > > On Thu, May 29, 2008 at 11:53:03PM +0200, Cristian Ionescu-Idbohrn wrote:
> > > >@@ -8540,6 +8541,9 @@
> > > > { BUILTIN_NOSPEC "let", letcmd },
> > > > #endif
> > > > { BUILTIN_ASSIGN "local", localcmd },
> > > >+#if ENABLE_ASH_BUILTIN_PRINTF
> > > >+ { BUILTIN_REGULAR "[", printfcmd },
> > > >+#endif
> > >
> > > are you sure that "[" is correct here?
> >
> > Of course it isn't. And that possibly has something to do with the
> > odd behaviour I experienced:
> >
> > | On the negative side, the above command line outputs all 100000
> > | lines to stdout, even if I redirect to /dev/null
> >
> > > Sounds a bit like it should be "printf", but i didn't look..
> >
> > Of course it should.
>
> This one does not seem right too:
>
> -USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
> +USE_PRINTF(APPLET_NOFORK(printf, printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER, printf))
Hmm... I must be blind :( Can't see it :( What's wrong? Compare to this
(some lines above in include/applets.h):
USE_DIRNAME(APPLET_NOFORK(dirname, dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dirname))
> case '\\':
> if (*++f == 'c')
> exit(EXIT_SUCCESS);
>
> You cannot exit from NOFORK applet!
Check.
> Also, please take a look into echo.c, specifically
> "We must check that stdout is not closed" comment.
> You need to do the same in printf.c if you want it to be
> an ash builtin or NOFORK.
Check.
> As for alloc, I just eliminated it completely - see current svn.
Nice.
Cheers,
--
Cristian
More information about the busybox
mailing list