additional applets available as ash builtins?

Denys Vlasenko vda.linux at googlemail.com
Sun Apr 13 00:12:29 UTC 2008


On Sunday 13 April 2008 00:33, Cristian Ionescu-Idbohrn wrote:
> On Sat, 12 Apr 2008, Cristian Ionescu-Idbohrn wrote:
> 
> > On Sat, 12 Apr 2008, Denys Vlasenko wrote:
> >
> > > This patch should make it even faster by not forking for all NOFORK
> > > applets.
> > >
> > > Can you give it a try?
> >
> > But of course.  Please give me until tomorrow.
> 
> Looks good for most of the applets I tested:
> 
>   basename, cat, chmod, dirname, echo, false, mkdir, rm, rmdir,
>   seq, sleep, sync, test, touch, true, usleep

I mostly worry about various obscure cases like this:

VAR=''
VAR=qwe sleep 4
echo "should be empty: '$VAR'"

They can be broken now after my quick hack. E.g. VAR value
may now "leak" into main shell environment.

(I didn't test, I just speculate)

> but I didn't touch these:
> 
>   awk, chgrp, chown, dd, find, hexdump, hostid, length, logname,
>   pwd, sort, whoami, xargs, yes
> 
> and found these seem to fork:
> 
> 'tac':

tac is NOEXEC:

USE_TAC(APPLET_NOEXEC(tac, tac, _BB_DIR_USR_BIN, _BB_SUID_NEVER, tac))

Of course it will fork. NOEXEC applets cannot avoid forking,
they can only avoid execing.

NOFORKing is, mathematically speaking, is "stronger" property.

From the C programmer point of view, making applet NOFORK is
harder, since it is not allowed to be careless.
Documentation explains that in more details.
--
vda



More information about the busybox mailing list