broken variable substitution in busybox's sh

Jamie Zawinski jwz at jwz.org
Fri Jan 12 05:24:53 UTC 2001


Package: busybox
Version: 0.48
Severity: normal

I would like to use only busybox for the boot ramdisk on my diskless
machines (http://www.jwz.org/kiosk/), but I find that I have to have
both busybox and sash.static on the system, because busybox doesn't
substitute variables in a useful way: variables are only substituted
if they are surrounded by whitespace.  This means that I can do this 
in sash, but not in busybox:

  mount -t nfs -r -o nolock $SERVER:/ /ro

busybox does not expand the environment variable "$SERVER" because of
the trailing colon and slash, but sash does.  I tried various games
with double quotes, etc., but couldn't make it do what I need.

    % busybox sh

    BusyBox v0.48 (2000.12.23-02:36+0000) Built-in shell
    Enter 'help' for a list of built-in commands.

    [root at codon guest]# export foo=FOO
    [root at codon guest]# echo $foo
    FOO
    [root at codon guest]# echo $foo/bar
    $foo/bar


    % sash
    Stand-alone shell (version 3.4)
    > setenv foo FOO
    > echo $foo
    FOO
    > echo $foo/bar
    FOO/bar

These are the only commands that I need to run from my init script;
busybox does all of them fine except for the variable substitution:

    mount -t nfs -r -o nolock $SERVER:/                 /ro
    mount -t nfs -r -o nolock $SERVER:/home/guest/share /ro2
    mount -t nfs    -o nolock $SERVER:/home/guest/$ID   /rw
    mv /dev rd/dev
    mkdir /dev
    mount -t nfs    -o nolock $SERVER:/home/guest/$ID/dev /dev
    exec /sbin/init '#'

(Sadly, I also can't get away with just using sash instead of busybox,
because sash's builtin "mount" command doesn't seem to do NFS properly,
while busybox's mount works fine.)

-- 
Jamie Zawinski
jwz at jwz.org             http://www.jwz.org/
jwz at dnalounge.com       http://www.dnalounge.com/

---------------------------------------
Received: (at 1090-done) by bugs.lineo.com; 9 Mar 2001 22:13:54 +0000


More information about the busybox mailing list