redo-sh: downgrade failures that affected dash; add a bash warning.
I feel a little dirty doing this, but the way the code was before, redo almost always picked bash as the shell. bash is way too overpowered and this led to bashisms in do scripts unnecessarily. The two failures in dash are things that I would really like to have, but they haven't materialized after 6 years, so I guess we should be realistic. To appropriately penalize bash for asking for trouble, I added a warning about [ 1 == 1 ] syntax being valid (as opposed to the POSIX correct [ 1 = 1 ]). This allows dash to be selected ahead of bash. I also moved 'sh' to the end of the list, because although it's the weakest shell on some systems, on other systems it's just bash. And I put zsh in front of bash, because fewer people have zsh and we want them to test zsh.
This commit is contained in:
parent
9354e78871
commit
0d174f92c3
3 changed files with 19 additions and 7 deletions
|
|
@ -111,7 +111,10 @@ f3=$(quiet_stderr eval ': ${f3:=
|
|||
g3="
|
||||
a
|
||||
b"
|
||||
[ "$f3" = "$g3" ] || fail 18
|
||||
# This is kind of a major problem, but rejecting dash and busybox sh because
|
||||
# of this may cause more trouble than it's worth: people end up writing .do
|
||||
# scripts with bashisms unnecessarily :(
|
||||
[ "$f3" = "$g3" ] || warn 18
|
||||
|
||||
|
||||
# Note: assignment of $@ in this context is unspecified (what do you even expect
|
||||
|
|
@ -371,11 +374,20 @@ false
|
|||
. ./nothing.od || warn 114
|
||||
|
||||
# this is actually a bash/kshism, but is allowed by POSIX: the parameters to
|
||||
# '.' should be passed to the sub-script. Because it's so useful, let's
|
||||
# require it, even though it's not strictly required by POSIX.
|
||||
# '.' should be passed to the sub-script.
|
||||
#
|
||||
# We used to require this, because it's so useful despite being optional in POSIX.
|
||||
# But unfortunately, too many shells (including dash) can't do it, so we ended up
|
||||
# always using bash, which leads people to write .do scripts with bashisms.
|
||||
set x y z
|
||||
. ./dotparams.od a b || fail 115
|
||||
# dotparams.od might warn 115
|
||||
. ./dotparams.od a b || fail 117
|
||||
[ "$1-$2-$3" = "x-y-z" ] || fail 116
|
||||
|
||||
# Warn about the way bash allows '==' in its test command.
|
||||
# This is the #1 bashism I've observed, and totally unnecessary, so let's
|
||||
# dock it some points so it doesn't always end up as the primary shell.
|
||||
[ 1 == 1 ] 2>/dev/null && warn 118
|
||||
|
||||
[ -n "$FAIL" ] || exit 40
|
||||
exit $FAIL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue