MSH function support

Denys Vlasenko vda.linux at googlemail.com
Sat Mar 21 19:54:51 UTC 2009


On Thursday 19 March 2009 13:07, Mike Frysinger wrote:
> > > what's the nommu status of hush ?  nommu is the only reason msh lives on.
> >
> > hush is working on NOMMU.
> 
> you dont happen to know off hand feature parity between the two ?  msh doesnt 
> support a whole lot, but it'd be annoying if one of those things were missing 
> in hush.  i'll switch the Blackfin dist to hush after our release (in the 
> process of freezing/making), so we'll get some testing there ...

What msh does and hush does not support:
* here documents
* (cmd)

Support for `cmd` in both msh in hush has a bug: if cmd
produces a long output, say `cat big_file`, both will
hang. This is because of vfork being used. hush warns
about it at build time, msh does not.

The second one I am a bit surprised, I though only (cmd;cmd)
is not supported, but I just tested and simple (cmd)
also does not work:

# ./busybox hush -c "(echo Hi)"
hush: nested lists are not supported on NOMMU

This can be fixed by adding code which detects when only one cmd
is there, but I want to fix it more generically, by vforking
and re-execing hush with command line "hush -c 'cmd;cmd'".
This will make it work with (cmd;cmd) too.

Aha, that's the reason why remembering functions as a string
instead as a tree is better: I can pass functions to such
re-execed hush as a parameter. Consider this:

var=val
func() {
	echo Hello world
}
(echo "$var";func;echo $?)

I cannot just vfork+re-exec "hush -c 'echo "$var";func;echo $?'".
I need to do:

hush -V 'var=val' -F 'func=\necho Hello world\n' -c 'echo "$var";func;echo $?'

and for this, I need to have all functions as strings!

> > NOMMU situation is very simple: the only applet which is
> > completely off-limits for NOMMU is ash.
> 
> yes, but there are sub-features which are no go's atm.  job support 
> (obviously) and sub shells (not so obvious depending on the code).

IIRC job control in hush is the same as on MMU. There is no reason
it should be more limited.

There no other NOMMU-related deficiencies in hush that I know of.
I am sure more testing might find some NOMMU bugs.

Pinging me about hush problems might make them disappear faster :)
--
vda


More information about the busybox mailing list