The busybox "printf" command is always 32 bit even when the shell isn't.

Denys Vlasenko vda.linux at googlemail.com
Sun Jan 4 16:05:00 UTC 2009


On Sunday 04 January 2009 05:27, Rob Landley wrote:
> On Saturday 03 January 2009 20:40:48 Denys Vlasenko wrote:
> > On Saturday 03 January 2009 22:32, Rob Landley wrote:
> > > $ printf %x 2251797561885434; echo
> > > 7ffff79c842fa
> > > $ ./busybox printf %x 2251797561885434; echo
> > > 79c842fa
> > >
> > > I need 64 bit math to convert timeconst.pl to timeconst.sh in the Linux
> > > kernel build...
> >
> > By your command
> 
> Thanks, and I'm happy to have this patch now to help get the perl removal 
> stuff into the kernel, but going forward I think there should probably be a 
> big config switch, "use 64 bit math on 32 bit platforms".
> 
> Generally if you want 64 bit math, you probably want it everywhere, but 32 bit 
> systems will be with us in the embedded world for a while yet (especially arm 
> and mips and such), and doing unnecessary 64 bit math there is especially 
> painful.
> 
> Also, what's the deal with ash "built in printf"?  Does this relate to nofork, 
> or is it a separate implementation, or...?

Shells have "builtins". Which are sort of NOFORK, but are enabled
independently of NOFORK. The rationale is that even if you do not
use NOEXEC and NOFORK _applets_ (which is understandable,
they are not as stable as I would like),
you sure want "echo", "test" etc in shells to not be slow as hell.

ash can be configured to treat printf as builtin.
--
vda


More information about the busybox mailing list