On Friday 2019-02-08 18:22, Martin Wilck wrote:
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?).
But who knows if some command within all the code calls "sh", and then would get bash implicitly again. """bosh is a Bourne-style POSIX command interpreter (shell), similar to dash, but supports multibyte input/output."""
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.
So, have bash invest a bit in optimizing the base dialect. It seems ridiculous that a mere syntactical difference leads to such great discrepancies: » for ((i=0; i<1000000;++i)); do echo '[ "$a$b" = 5 ]'; done >ca1 » for ((i=0; i<1000000;++i)); do echo '[[ "$a$b" = 5 ]]'; done >ca2 » time pbosh ca1 real 0m3.198s user 0m3.145s sys 0m0.052s » time bash ca1 real 0m3.987s user 0m3.985s sys 0m0.000s » time bash ca2 real 0m2.669s user 0m2.668s sys 0m0.000s If anything else, this reeks of embrace-extend-extinguish. First make [ suck, add [[, then make everyone write [[ just to be able to reach or beat the [ implementation of another sh. Something is wrong here.
OTOH, shell script performance matters much less these days than it used to.
The question is only to whom, and will point to https://xkcd.com/303/ .
Which leaves us with SUSE-specific software, and from a glance at e.g. github.com/openSUSE/sysconfig, they all quite consistently declare bash. I would argue that, in fact, people rather write #!/bin/bash these days just because it's in more or less every howto, and no newbie wants to have to deal the significant changes that a POSIX sh would bring.
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.
"We always did it that way" is just not a very good argument for anything. I have not argued for changing the openSUSE defaults (not yet anyway). But I would like to have the possibility to switch everything that does not hardrequire bash to just use another sh on my system that may just be that tad bit faster that, in the spirit of xkcd303, improves my productivity at the end of the day. Think of what clang brought to the compiler ecosystem by being a mostly-drop-in replacement for gcc.
Do you require POSIX compliance?
No.
Or compliance with dash's features, which is not the same?
No.
I'm surprised - "No" to both of these, yet you reject bash-isms?
I do not reject submissions to openSUSE:Factory if they have bash-specific code. But I will make the proposal to either change them to sh, or annotate the section as "/bin/bash" (depending on triviality). If all a scriptlet does is [[ "$1" = 0 ]], then it's going to be [ "$1" = 0 ]. If however it tries funny things like ${x/a/b} or =~, it will just get annotated as #!/bin/bash.
Back to my point - openSUSE needs to have a reliable standard what kind of shell syntax is acceptable in scriptlets which don't use "-p".
The aim surely is sh, simply because most specfiles are simple, already compliant or annotated -- judging from all the files that have passed me by within the last two-plus years. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org