Mailinglist Archive: opensuse-factory (401 mails)

< Previous Next >
Re: [opensuse-factory] Can we assume that /bin/sh is bash?
On Wed, 13 Mar 2019 13:59:08 +0100
Stephan Kulow <coolo@xxxxxxx> wrote:

On 3/13/19 1:56 PM, Michal Suchánek wrote:
Bash has documentation. If implementation does not match documentation
you can file a bug as much as you can against a POSIX-compliant shell.
With bash being much more active project than most POSIX-compliant
shells the bug is even much more likely to get resolved. And unlike
POSIX-compliant shells bash has BASH_VERSION which tells you *exactly*
what you are getting in case you need to support multiple versions that
behave differently.

And if you're in need of writing shell scripts that are specific to bash
versions,
you're free to require /bin/bash as interpreter.


It is not always clear how to do that. I thought there is a way to
switch rpm spec scriptlets to different shell but did not find how to
do that for %build.

Anyway, if we provide alternatives for /bin/sh you can assume any shell
that claims to be vaguely bourne-compatible can end up as /bin/sh. All
these shells have various bugs. Writing shell code that is
bug-compatible with all shells the distribution ships is non-trivial.
Some bugs are due to parser issues that are complex to fix and will not
be resolved overnight.

Ergo if we do provide alternatives for /bin/sh we cannot expect
anything from /bin/sh anymore. Then you need to specify the interpreter
for every shell script. Then there is no point in even having a /bin/sh.

Thanks

Michal
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >