Subject: Re: [vserver] [PATCH] support for busybox grep and busybox shell
From: Natanael Copa <natanael.copa@gmail.com>
Date: Fri, 03 Aug 2007 15:29:42 +0200

On Fri, 2007-08-03 at 14:35 +0200, Daniel Hokka Zakrisson wrote:
> Natanael Copa wrote:
> > Hi,
> >
> > Those patches was needed to be able to run vserver with busybox grep and
> > busybox ash as shell.
> >
> > The shell patch should not be needed with the next release of busybox.
> 
> You realize you could just set /etc/vservers/.defaults/shell to whatever
> you want, right? That's the ENTER_SHELL test...

I guess I missed that part of the documentation. Thanks!

> > There are more issues with busybox (mktemp does not work) but this is a
> > start.
> >
> > PS. as a sidenote... it would be awesome if we could get rid of bash and
> > have POSIX compliant shell code. See the BUGS section in bash manpage. I
> > would be glad to help out in converting the scripts and get rid of some
> > other bloat.
> 
> I like the bashisms. They mean we get a defined working environment, so
> shells different interpretations of POSIX or whatever don't affect us...

well.. I'm trying to make a minimal vserver host. Now look at this:

nc ~ # ls -l /bin/bash /bin/busybox
-rwxr-xr-x 1 root root 713696 Aug  3 06:13 /bin/bash
-rwxr-xr-x 1 root root 778696 Aug  1 17:41 /bin/busybox

busybox ash is almost compatible with bash. Has cmdline completion and
lots other nice things. Basicly it misses arrays. But in addition to the
shell it also provides thees tools:

        [, [[, addgroup, adduser, adjtimex, ar, arp, arping, ash,
        awk, basename, bb, bbconfig, bunzip2, bzcat, cal, cat,
        catv, chgrp, chmod, chown, chroot, chvt, cksum, clear,
        cmp, comm, cp, cpio, crond, crontab, cryptpw, cttyhack,
        cut, date, dc, dd, deallocvt, delgroup, deluser, df, dhcprelay,
        diff, dirname, dmesg, dos2unix, du, dumpkmap, dumpleases,
        echo, ed, egrep, eject, env, ether-wake, expr, fakeidentd,
        false, fbset, fdflush, fdformat, fdisk, fgrep, find, fold,
        free, freeramdisk, ftpget, ftpput, fuser, getopt, getty,
        grep, gunzip, gzip, halt, head, hexdump, hostid, hostname,
        httpd, hwclock, id, ifconfig, ifdown, ifup, inetd, init,
        insmod, install, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink,
        iproute, iprule, iptunnel, kill, killall, killall5, klogd,
        last, length, less, linuxrc, ln, loadfont, loadkmap, logger,
        login, logread, losetup, ls, lsmod, lzmacat, makedevs,
        md5sum, mdev, mesg, mkdir, mkfifo, mknod, mkswap, mktemp,
        modprobe, more, mount, mountpoint, mt, mv, nameif, nc,
        netstat, nice, nmeter, nohup, nslookup, openvt, passwd,
        patch, pidof, ping, ping6, pipe_progress, poweroff, printenv,
        printf, ps, pwd, raidautorun, rdate, readahead, readlink,
        readprofile, realpath, reboot, renice, reset, resize,
        rm, rmdir, rmmod, route, run-parts, runlevel, rx, sed,
        seq, setconsole, setkeycodes, setlogcons, setsid, sh,
        sha1sum, sleep, sort, split, start-stop-daemon, stat,
        strings, stty, su, sum, swapoff, swapon, sync, sysctl,
        syslogd, tail, tar, tee, telnet, test, tftp, time, top,
        touch, tr, traceroute, true, tty, udhcpc, udhcpd, umount,
        uname, uncompress, uniq, unix2dos, unlzma, unzip, uptime,
        usleep, uuencode, vconfig, vi, vlock, watch, watchdog,
        wc, wget, which, who, whoami, xargs, yes, zcat, zcip


so while bash gives you a shell with arrays, busybox gives you a
complete system using almost the same size.

> That said, I'm not entirely opposed to the idea, given that POSIX-sh
> doesn't make the scripts more complicated or harder to read...

I don't think it will be harder to read. Maybe even easier. I could make
a sample for you when i get time. I suspect it will require some work.

> > Natanael Copa
> 
> The grep patch looks sane, thanks.