[Top][All Lists]

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

Re: export in posix mode

From: Bob Proulx
Subject: Re: export in posix mode
Date: Wed, 27 Feb 2013 15:34:01 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

James Mason wrote:
> We considered setting up another shell as the implementation of
> "/bin/sh", but that's hazardous in the context of vast amounts of
> boot-time initialization scripting that hasn't been vetted as to
> avoidance of bash-isms.

You appear to be doing product QA.  Awesome!  Have you considered
setting up a chroot system or a VM in different configurations and
running continuous integration testing upon them?  Within limits of
kernel compatibility chroots are very lightweight.  I am a fan due to
the simplicity.  Or VMs are quite accessible these days for the full
system including kernel now that most recent cpus support full

> Changing product script code - just so you can look for these sorts
> of things - isn't practical (or safe) either.

Things generally are not that bad.  I have tried this type of thing on
occasion and usually while there are a few errors it isn't anything
bad enough to prevent the system from booting to a useful state.  And
if it is a test VM without a lot of non-essential stuff then the core
functionality is usually fine.

> So I guess if you take the view that bash POSIX mode exists only to
> make bash accept POSIX scripts, and not to preclude/warn about
> behavior that isn't going to be acceptable elsewhere, then you're
> right - it's not a bug.   If you care about helping people to be
> able to write scripts that work various places and don't exceed the
> POSIX specification, you're unhelpfully wrong (and you might
> contemplate why "bashisms" gives > 50K google hits).

It is not a bash issue anymore than it is an issue specific to csh,
ksh, pdksh, zsh or any other specific featureful shell.  If it is a
bug in one then it is a bug in all.

While the bash project does not exist for the purpose you describe
this does not prevent other projects such as dash and posh from
existing and being useful.  Whether the operating system as an entity
decides to use bash or dash or other as a /bin/sh is a decision for
them to make for themselves.  If your OS does something different then
I say take the issue up with your operating system.

Debian for example uses /bin/sh symlinked to dash for just that
reason.  Works great.  I don't see any problem.  Scripts that wish to
use bash features specify #!/bin/bash as the interpreter.  Scripts
that specify #!/bin/sh and use bash specific features will fail.  As a
local option the local admin may change the /bin/sh symlink from dash
to bash and run scripts from other systems that include bash features.
But that isn't by default.  However it is a useful option for people
stuck needing to run code that isn't cleanly written.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]