shelltest.od: we accidentally treated some fails as mere warnings.

We were setting a global variable FAIL on failure, but if we failed
inside a subshell (which a very small number of tests might do), this
setting would be lost.  The script output (a series of failed/warning
lines) was still valid, but not the return code, so the shell might be
selected even if one of these tests failed.

To avoid the problem, put the fail/warning state in the filesystem
instead, which is shared across subshells.
This commit is contained in:
Avery Pennarun 2018-12-17 12:33:17 +00:00
commit 6cf06f707a
5 changed files with 12 additions and 9 deletions

View file

@ -13,7 +13,7 @@ WARN=
# use some non-portable feature.
for sh in dash /usr/xpg4/bin/sh ash posh mksh ksh ksh88 ksh93 pdksh \
zsh bash busybox /bin/sh; do
printf "%-30s" "Testing $sh..."
printf " %-22s" "$sh..."
FOUND=`which $sh 2>/dev/null` || { echo "missing"; continue; }
# It's important for the file to actually be named 'sh'. Some