When bash is started as /bin/sh it run in posix compatibility mode.
But when invoked as /bin/bash it does some things ... differently.
Most notably:
Subshells spawned to execute command substitutions inherit the
value of the -e option from the parent shell. When not in posix
mode, bash clears the -e option in such subshells.
It is a mystery why anyone thought the `non-posix' behaviour was
desirable. One effect in practice is that osstest's cr-daily-branch
can blunder on if one of its version fetches fails.
AFAICT the only documented way to get rid of this anomalous behaviour
is to switch bash to posix mode. I have read through the wheezy
bash(1) manpage and searched for posix, and the following behavioural
differences are described:
* Differences in interative startup (not relevant to us).
* Minor (irrelevant) differences in which startup files are read
during noninteractive startup. (Eg, BASH_ENV not honoured.)
* Differences to the parsing of invocations of `time'
* `test a == b' may be unsupported (but it's wrong and we say `=')
* -e not inherited by some subshells (this is what I am trying to fix)
* `.' and `source' do not search the cwd.
* `set' with no arguments does not print shell functions etc.
So I think, with the previous patch, that these changes are all
desirable or at least harmless.
I have not added `set -o posix' to shell script fragments invoked by
various scripts (eg Perl and Tcl scripts). Those scripts might be
processed by bash if /bin/sh is bash, but when is invoked as sh it
runs in posix mode anyway.
I have done some ad-hoc testing but it seems like much of this is
difficult to test. I suggest we push it at a time when we can keep a
close eye on the behaviour.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
. ./cri-lock-repos
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
new=$2
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
. ./cri-lock-repos
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
. ./cri-lock-repos
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -ex
+set -ex -o posix
branch=$1
revision=$2
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
xenbranch=$1
xenrevision=$2
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
xenbranch=$1
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -ex
+set -ex -o posix
. ./cri-args-hostlists
branch=$1; shift
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -ex
+set -ex -o posix
. ./cri-args-hostlists
. ./ap-common
-set -e
+set -e -o posix
export FOR_LOGFILE="$*"
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -ex
+set -ex -o posix
. ./cri-bisect
. ./cri-args-hostlists
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -ex
+set -ex -o posix
export OSSTEST_BLESSING=adhoc
#!/bin/bash
-set -e
+set -e -o posix
xenbranch=$1
p=
-#!/bin/bash -e
+#!/bin/bash
# This is part of "osstest", an automated testing framework for Xen.
# Copyright (C) 2009-2013 Citrix Inc.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+set -e -o posix
+
if [ -e $HOME/.xen-osstest/settings ]; then
source $HOME/.xen-osstest/settings
fi
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
xenbranch=$2
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
branch=$1
xenbranch=$2
# passing --debug in REF-CONDS too)
# -n Dry run: do not actually run cs-adjust-flight
-set -e
+set -e -o posix
exec 3>/dev/null
verbose=''
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
. ./cri-common
# - create any input/output tree on xenbits
# - run any test flights (obviously)
-set -e
+set -e -o posix
fail () { echo >&2 "$*"; exit 1; }
badusage () { fail 'bad usage'; }
#!/bin/bash
-set -e
+set -e -o posix
. ./cri-getconfig
. ./mgi-common
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
. ./cri-getconfig
. ./mgi-common
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
. ./cri-getconfig
END
}
-set -e
+set -e -o posix
publish=false
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
. ./cri-getconfig
. ./mgi-common
# cd ~osstest
# for f in branches/*.git; do ./update-live 3c464fbf8a05b24f4afb7e58bcf4ae77fbb7ad0c $f; done
-set -e
+set -e -o posix
bad="$1"
dir="$2"
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
usage(){
cat <<END
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
usage(){
cat <<END
# where COMMAND ARGS SCRIPT
# runs shell script SCRIPT in an appropriate directory and place
-set -e
+set -e -o posix
result=`"$@" 'hg heads --template '\''{node|short}\n'\'''`
lines=`printf '%s\n' "$result" | wc -l`
#!/bin/bash
-set -e
+set -e -o posix
usage() {
cat >&2 <<EOF
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
set -o pipefail
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
+set -e -o posix
usage(){
cat <<END