[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]



  I decided to link /bin/sh -> ash after the recent discussion here and I
thought I'd give a brief description of the few things that broke, in particular
one very common problem I'm seeing.

  Basically -- almost everything (except svgatextmode but there's already an
open bug against it for this) appears to *work* correctly.  About the only
difficulties I've had involve maintainer scripts for packages; for some reason,
they seem to be much more susceptible to bashisms than other shell scripts.

  There are three different bashisms that I've run into:

 -> '=' != '==' !  Bash will accept a C-style '==' in 'test' or '[' statements.
   ash will not.  This is what 90% of the problem I encountered were -- in fact,
   I just did 'grep == /var/lib/dpkg/info/*' and filed bug reports against
   four or five packages for this very problem :)  (I notice, incidentally, that
   xbanner has many instances of this and has an open bug from April)

 -> 'function foo() {' is another bashism; just use 'foo() {'
 -> The most exotic one: if 'foo' is a script in the current directory (and . is
   not in the PATH), bash will source it on '. foo'; ash needs '. ./foo'.

 (the last two only affected two packages, and I suspect that the last one is
  not a very common case, but I thought people might want to know :) )

  I don't know much about lintian.  Could tests be implemented for the common
cases here? (eg: if ash is on the system, try to compile #!/bin/sh scripts with
ash -- if it suceeds, grep them for "[ +[^\]]* +==" and print a warning if we
find it..this could give false positives though..)


  The universe, they said, depended for its operation on the balance of four
forces which they identified as charm, persuasion, uncertainty and
bloody-mindedness.  Thus it was that the sun and the moon orbited the Disc
because they were persuaded not to fall down, but didn't actually fly away
because of uncertainty...
  Some druids suggested that there were certain flaws with this theory, but
senior druids explained very pointedly that there was indeed room for informed
argument, the cut and thrust of exciting scientific debate, and basically
it lay on top of the next solstice bonfire.

     -- Terry Pratchett on Discworld religion, _The Light Fantastic_

Reply to: