Mailinglist Archive: opensuse-factory (401 mails)

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

On 3/13/19 2:19 PM, Michal Suchánek wrote:
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.Again, if you find yourself in need to write bash
version specific %build scripts,
write them in a real language - or at least put them in an extra script.

I am fine with it being any bash version form SLE11 to TW. As in if it
builds everywhere it's ok.

I am not fine if we switch it to 'any shell for which somebody installs
an alternative'.



Anyway, if we provide alternatives for /bin/sh you can assume any shell
Yeah, that's right. *If* - *if* a shell in openSUSE wants to provide /bin/sh,
it needs to
eat all our rpm snippets that survived checkbashisms. Just because bash
provides it,
doesn't mean there are alternatives worth fighting over theoretic problems.

That's the problem. If people provide a broken /bin/sh alternative or
one of the /bin/sh alternatives eventually regresses people will come
complaining to me that my package does not build.

If people provide two different /bin/sh alternatives with very
different behavior in some corner cases I will need to rewrite my
packaging scripts when I hit the corner case.

I have been there writing scripts for Debian which provides
several /bin/sh alternatives each with its unique set of bugs. I want
no more of that.


And %build sections should potentially even be executed by /bin/bash --posix
right away.
But again, if your %build section is bash version specific, it's a lost case
IMO.

You need not even use bash-specific syntax at all. You might just use
some variable scoping that happens to work in bash and happens to not
work in some other shell.

Thanks

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

< Previous Next >