[lxc-devel] using posix shell instead of bash

Michael H. Warfield mhw at WittsEnd.com
Wed Nov 14 18:50:54 UTC 2012


On Wed, 2012-11-14 at 09:54 -0600, Serge Hallyn wrote:
> Quoting Natanael Copa (ncopa at alpinelinux.org):
> > Hi,
> > 
> > I wonder if it there are any interest to make the scripts posix shell
> > compliant so they can run with for example busybox ash and dash.
> > 
> > I would like to provide proper LCX support for Alpine Linux, which by
> > default runs from tmpfs. It uses uclibc and busybox as the base system,
> > which makes it very lightweight. Looking at the scripts, it seems like
> > it would be fairly easy to adjust the script to not depend on bash at
> > all, making it possible to make the LCX host even lighter.
> > 
> > Before I start with sending patches, is this something that you would
> > be interested in, or are you married with bash (like the vserver ppl)?

> I don't think anyone is married to bash here.  The debian package has
> changed some scripts from bash to sh.  I'm only leery of resulting
> breakages and reports of subtle time-consuming bugs, and potentially
> less-maintainable code.

> (Note also that lxc-ls may be rewritten in python.  Is that a problem
> for your use case?)

Some reason?  Sorry.  In my "day job" I have to maintain code written in
C, bash, sh, ash (I wrote and array function library for ash and
busybox), perl and python, including a raft of stuff that interfaces to
web scrappers and SQL databases.  My team and I find python to be the
least maintainable and all the cruft that our predecessors wrote in
python is getting rewritten in perl so it can be maintained as soon as
we figure out what the hell they did in there...  We had one guy who was
absolutely in love with python and django and left us with a mess.  Now,
that may well be his fault to begin with being that it is uncommented
highly recursive web processing code (yes it uses "beautiful soup") that
drives us all nuts and breaks with nothing more that the classical
python backtrace.  I know a lot of people are just in love with python
but I wouldn't just rewrite it unless there was a really good reason to.

> > Would you be prepared for minor sacrifices to use posix compliant shell
> > scripts?

> Someone else can jump in if they object, but I personally don't.  Are
> you willing to subscribe to github.com/lxc/lxc#staging commits and
> watch for new commits re-breaking posix compliance?

Converting from bash to ash (which is very sh like) isn't too bad if you
are not making extensive use of arrays and string functions.  It's
probably doable (having done it myself with some fairly sophisticated
bash scripts dealing with LUKS encryption and file systems).  I would
start by trying to run it under busybox ash and see what breaks.

> Successful runs of https://code.launchpad.net/~serge-hallyn/+junk/lxc-test
> with your patches will also be reassuring.

> -serge

Regards,
Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121114/98008d2a/attachment.pgp>


More information about the lxc-devel mailing list