Bug in ampersand handling in 1.13.0's ash

Wilmer van der Gaast lintux at gmail.com
Mon Nov 24 14:53:04 PST 2008


Hello,

After lots of experimenting, I finally found the bug that was
bothering me for ages: I'm replacing components of a Netgear router
root filesystem with newer stuff (adding IPv6 support, upgrading to a
newer BusyBox with more applets, etc.), but whenever I tried to boot
it with a newer Busybox shell, it doesn't boot properly.

Now I know what's going on. Some of the closed source apps that I have
to stick to do things like:

system("start_some_broken_daemon arg1 arg2&");

to start something in the background. This ampersand isn't properly
noticed by ash, unless there's whitespace around it (either before or
after). As it turns out, the tokenizer sees an end of file and
completely forget there was an &. More interesting, it will instead
see the last token twice! See this example:

/tmp # ./ash -c '/bin/echo 1&'
1 1
/tmp # ./ash -c '/bin/echo 1 &'
1
/tmp # ./ash -c '/bin/echo 1& '
1

My knowledge on how parsers work is very weak, so I decided I'd just
report this as a bug instead of trying to fix it myself. :-/ I saw the
bug tracker is currently down, so I'm trying the mailing list instead.
If there's a more suitable list to report this at, please do tell.
Meanwhile I'll try 1.12.2, so far I didn't notice 1.13.0 was marked
unstable...

Thanks for the awesome piece of software,


Wilmer van der Gaast.


More information about the busybox mailing list