Mailinglist Archive: opensuse-factory (602 mails)

< Previous Next >
Re: [opensuse-factory] Can we assume that /bin/sh is bash?
Martin Wilck <mwilck@xxxxxxxx> wrote:

On Fri, 2019-02-08 at 17:35 +0100, Jan Engelhardt wrote:
On Friday 2019-02-08 15:03, Martin Wilck wrote:

For me the question is, what's the benefit?

Off the top of my head and not very scientifically measured,
./configure for kopano.spec completes 15% faster with pbosh.

That's truly interesting. But I can bounce back your argument: you
could surely run "pbosh ./configure" to the same effect (what's pbosh,
btw? did you mean posh?).

"posh" is not a shell but a joke. It is full of bugs and cannot be seen as a
serious POSIX shell implementation. "pbosh" is a compile variant of "bosh"
which is the maintained portable and enhanced Bourne Shell that allows to be
compiled compatible to the SVr4 Bourne Shell (obosh), a minimal strict POSIX
variant (pbosh) and an enhanced POSIX variant (bosh).

People who like to run "configure" tests as benchmarks should know that
there is a need to make sure that sub-shells are called correctly.

You need to call something like:

CONFIG_SHELL=$shell $shell ./configure

Btw the comparison is a bit unfair: "configure", by design, is written
in the most portable shell dialect possible, forfeiting all chances for
bash to catch up with optimized builtins.

This is not unfair. If you like to compare, I recommend you to use a ksh93 from
2008 which is the fastest shell ever and edit "configure" to switch off the
important related ksh93 builtins. Note that ksh93 from 2008 is nearly twice as
fast as bash.

The most called programs are:


in the order of usage.

The reason why ksh93 is so fast is:

- it uses vfork(), this is also true for bosh since 4 years.
- it has a rewritten parser/interpreter that is larger
(more code) but faster than the historic Bourne Shell
This also applies to bosh
- ksh93 does not fork for "(subcmd)". It rather creates
a new set of "global variables" in a structure.
This is ksh93 specific.
- ksh93 uses an own i18n implementation with interface
functions that better fit to the needs of a shell.

There is some evidence that bash is not the fastest of shells (
). OTOH, shell script performance matters much
less these days than it used to.

dash is approx. 30% faster than bash because it does not suport multi-byte

But isn't that also an argument for having /bin/sh always point to
bash? Like it or not, bash is the "de-facto standard" (yuck) shell
today under Linux. People expect it to be that way.

BTW: Most of the bash "extensions" are taken from ksh93. The POSIX standard
shell definition was derived from the features from ksh88 with [[ ]], (( ))
and array variables removed.


EMail:joerg@xxxxxxxxxx (home) Jörg Schilling D-13353 Berlin
joerg.schilling@xxxxxxxxxxxxxxxxxxx (work) Blog:
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups