Skip to contentSkip to conversation

Remove obsolete file "test.sched"

PATCH In review Ian Jackson 2 participants 6 messages Sep 24, 2015 – Sep 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Remove obsolete file "test.sched"

---
 test.sched |    5 -----
 1 file changed, 5 deletions(-)
 delete mode 100755 test.sched
test.sched deleted +0 -5
deleted file mode 100755
index ca309fb..0000000
@@ -1,5 +0,0 @@
-#!/bin/sh
-set -e
-./ts-install-debian
-./ts-build-prep
-./ts-build-xen
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 Shell fixup: Make all invocations of `.' (`source') use ./

In POSIX, .' (the shell builtin) respects PATH, and does not search .' (the current directory).

Change all the invocations which refer to files which are part of osstest to say . ./foo' instead of simply . foo'.

I have checked the results of
git-grep '^[ \t]*\. [^./]'
after this patch and the remaining five hits are of no concern.

As a double-check of my hand-editing, I have also done this
perl -i~ -pe 's#^(\s*\. )\./#$1#' *
and verified that the resulting tree is almost identical to that before this commit. There is one difference, where the original code already said `. ./job'.

---
 ap-fetch-version               |    6 +++---
 ap-fetch-version-baseline      |    2 +-
 ap-fetch-version-baseline-late |    6 +++---
 ap-fetch-version-old           |    6 +++---
 ap-print-url                   |    6 +++---
 ap-push                        |    6 +++---
 ap-qemu-revision               |    4 ++--
 ap-qemu-url                    |    4 ++--
 cr-all-branch-statuses         |    2 +-
 cr-daily-branch                |    4 ++--
 cr-try-bisect                  |    4 ++--
 cr-try-bisect-adhoc            |    6 +++---
 cri-args-hostlists             |    6 +++---
 cri-common                     |    4 ++--
 cri-lock-repos                 |    2 +-
 make-distros-flight            |    6 +++---
 make-flight                    |    8 ++++----
 mg-all-branch-statuses         |    2 +-
 mg-cpu-microcode-update        |    4 ++--
 mg-debian-installer-update     |    4 ++--
 mg-debian-installer-update-all |    2 +-
 mg-execute-flight              |    2 +-
 mg-pxe-loader-update           |    4 ++--
 standalone                     |    2 +-
 standalone-reset               |    4 ++--
 25 files changed, 53 insertions(+), 53 deletions(-)
ap-fetch-version +3 -3
index 62adf79..086aa62 100755
@@ -20,10 +20,10 @@
 set -e
 
 branch=$1
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 if info_linux_tree "$branch"; then
 	repo_tree_rev_fetch_git linux \
ap-fetch-version-baseline +1 -1
index e693e16..8889d1e 100755
@@ -21,7 +21,7 @@ set -e
 
 branch=$1
 
-. cri-lock-repos
+. ./cri-lock-repos
 
 : ${BASE_TREE_LINUX:=git://xenbits.xen.org/people/ianc/linux-2.6.git}
 : ${BASE_TAG_LINUX:=xen/next-2.6.32}
ap-fetch-version-baseline-late +3 -3
index ef1a8b1..3db443d 100755
@@ -22,10 +22,10 @@ set -e
 branch=$1
 new=$2
 
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 case "$branch" in
 
ap-fetch-version-old +3 -3
index 716fc8f..9d5487a 100755
@@ -20,10 +20,10 @@
 set -e
 
 branch=$1
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 : ${BASE_TAG_LINUX2639:=tested/2.6.39.x}
 : ${BASE_LOCALREV_LINUX:=daily-cron.$branch.old}
ap-print-url +3 -3
index c161169..1b178c7 100755
@@ -20,10 +20,10 @@
 set -e
 
 branch=$1
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 if info_linux_tree "$branch"; then
 	echo $TREE_LINUX_THIS
ap-push +3 -3
index aa0ec3d..ea21887 100755
@@ -21,13 +21,13 @@ set -ex
 
 branch=$1
 revision=$2
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
 
 : ${TAG_LINUX2639:=tested/2.6.39.x}
 
-. ap-common
+. ./ap-common
 
 TREE_LINUX=$PUSH_TREE_LINUX
 TREE_QEMU_MAINLINE=$PUSH_TREE_QEMU_MAINLINE
ap-qemu-revision +2 -2
index abfa650..de105ca 100755
@@ -22,8 +22,8 @@ set -e
 xenbranch=$1
 xenrevision=$2
 
-. cri-lock-repos
-. ap-common
+. ./cri-lock-repos
+. ./ap-common
 
 cd "$repos/xen"
 git cat-file blob $xenrevision:Config.mk | perl -ne '
ap-qemu-url +2 -2
index 1161a46..6ed704a 100755
@@ -21,7 +21,7 @@ set -e
 
 xenbranch=$1
 
-. cri-lock-repos
-. ap-common
+. ./cri-lock-repos
+. ./ap-common
 
 echo $TREE_QEMU
cr-all-branch-statuses +1 -1
index f9885db..f4ed46e 100755
@@ -18,7 +18,7 @@
 
 set -ex
 
-. cri-args-hostlists
+. ./cri-args-hostlists
 branch=$1; shift
 
 check_stop all-branch-statuses.
cr-daily-branch +2 -2
index dd9c30a..06f4b38 100755
@@ -19,8 +19,8 @@
 
 set -ex
 
-. cri-args-hostlists
-. ap-common
+. ./cri-args-hostlists
+. ./ap-common
 branch=$1; shift
 select_branch
 info_linux_tree $branch ||:
cr-try-bisect +2 -2
index 8f00537..06c4940 100755
@@ -19,8 +19,8 @@
 
 set -ex
 
-. cri-bisect
-. cri-args-hostlists
+. ./cri-bisect
+. ./cri-args-hostlists
 
 branch=$1; shift
 select_branch
cr-try-bisect-adhoc +3 -3
index c34c74c..4ff8b8c 100755
@@ -21,7 +21,7 @@ set -ex
 
 export OSSTEST_BLESSING=adhoc
 
-. cri-common
+. ./cri-common
 
 nope () { echo "nope: $*"; exit 0; }
 
@@ -34,8 +34,8 @@ if ! test -f job; then nope "no job"; exit 0; fi
 #   testid=
 #   bisect= list of args to cs-bisection-step, eg  '--fail-flight=<mumble>'
 
-. cri-bisect
-. cri-args-hostlists
+. ./cri-bisect
+. ./cri-args-hostlists
 select_branch
 
 export OSSTEST_BLESSING=adhoc
cri-args-hostlists +3 -3
index 0dd2ef3..58a2252 100644
@@ -34,13 +34,13 @@ check_stop () {
 	check_stop_core "$1"
 	if test -f ${1}xsettings; then
 		echo "loading ${1}xsettings"
-		. ${1}xsettings
+		. ./${1}xsettings
 	fi
 }
 
 check_stop ''
 
-. cri-common
+. ./cri-common
 
 dcs=daily-cron-settings
 
@@ -56,7 +56,7 @@ fi
 
 : ${OSSTEST_EMAIL_HEADER:=daily-cron-email-$OSSTEST_BLESSING}
 
-. ${OSSTEST_CRON_SETTINGS:-$dcs-$OSSTEST_BLESSING}
+. ./${OSSTEST_CRON_SETTINGS:-$dcs-$OSSTEST_BLESSING}
 
 : ${OSSTEST_PUSH:=false}
 
cri-common +2 -2
index c874ff9..6dfe8df 100644
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-. cri-getconfig
+. ./cri-getconfig
 
 umask 002
 
@@ -101,6 +101,6 @@ select_branch () {
 	mrof="$branch.mro"
 
 	if test -f branch-settings.$branch; then
-		. branch-settings.$branch
+		. ./branch-settings.$branch
 	fi
 }
cri-lock-repos +1 -1
index c8269f3..e75e3f5 100644
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-. cri-common
+. ./cri-common
 
 repos=`getrepos`
 repos_lock="$repos/lock"
make-distros-flight +3 -3
index d407fcb..697a171 100755
@@ -26,9 +26,9 @@ buildflight=$4
 
 flight=`./cs-flight-create $blessing $branch`
 
-. cri-common
-. ap-common
-. mfi-common
+. ./cri-common
+. ./ap-common
+. ./mfi-common
 
 defsuite=`getconfig DebianSuite`
 defguestsuite=`getconfig GuestDebianSuite`
make-flight +4 -4
index 70c909d..8dc4e64 100755
@@ -26,10 +26,10 @@ buildflight=$4
 
 flight=`./cs-flight-create $blessing $branch`
 
-. cri-common
-. cri-getplatforms
-. ap-common
-. mfi-common
+. ./cri-common
+. ./cri-getplatforms
+. ./ap-common
+. ./mfi-common
 
 defsuite=`getconfig DebianSuite`
 defguestsuite=`getconfig GuestDebianSuite`
mg-all-branch-statuses +1 -1
index bba7216..74dc09a 100755
@@ -27,7 +27,7 @@
 
 set -e
 
-. cri-common
+. ./cri-common
 
 mkdir -p tmp
 
mg-cpu-microcode-update +2 -2
index c375a43..4d51dfb 100755
@@ -2,8 +2,8 @@
 
 set -e
 
-. cri-getconfig
-. mgi-common
+. ./cri-getconfig
+. ./mgi-common
 
 # iucode_tool is in /usr/sbin, see #788459.
 export PATH="/usr/local/sbin:$PATH:/sbin:/usr/sbin"
mg-debian-installer-update +2 -2
index 526cdf1..6070b8a 100755
@@ -21,8 +21,8 @@
 
 set -e
 
-. cri-getconfig
-. mgi-common
+. ./cri-getconfig
+. ./mgi-common
 
 suite=$1
 arch=$2
mg-debian-installer-update-all +1 -1
index 241e2e3..1bbaef7 100755
@@ -20,7 +20,7 @@
 
 set -e
 
-. cri-getconfig
+. ./cri-getconfig
 
 suite=`getconfig DebianSuite`
 fws=`getconfig DebianNonfreeFirmware`
mg-execute-flight +1 -1
index 7f3d969..0d8c792 100755
@@ -48,7 +48,7 @@ while [ $# != 0 ]; do
 	esac
 done
 
-. cri-getconfig
+. ./cri-getconfig
 
 if [ x"$flight" = x ]; then badusage; fi
 
mg-pxe-loader-update +2 -2
index 386e449..9774350 100755
@@ -23,8 +23,8 @@
 
 set -e
 
-. cri-getconfig
-. mgi-common
+. ./cri-getconfig
+. ./mgi-common
 
 suite=$1
 
standalone +1 -1
index 60b6666..9383d72 100755
@@ -123,7 +123,7 @@ while true ; do
     esac
 done
 
-. cri-getconfig
+. ./cri-getconfig
 
 WebspaceLog=`OSSTEST_CONFIG=$config getconfig WebspaceLog`
 if [ ! -r "$WebspaceLog" ] ; then
standalone-reset +2 -2
index 8555039..0a69915 100755
@@ -37,10 +37,10 @@ done
 shift $((OPTIND-1))
 
 if [ -f standalone.config ] ; then
-    . standalone.config
+    . ./standalone.config
 fi
 
-. cri-getconfig
+. ./cri-getconfig
 
 jobdb=`getconfig JobDB`
 if [ "$jobdb" != Standalone ]; then
Signature · 1 line
1.7.10.4
Acked-by on v1 2/3
#2 lore raw

Re: [OSSTEST PATCH 2/3] Shell fixup: Make all invocations of `.' (`source') use ./

Quoted 10 lines · Ian Jackson

In POSIX, .' (the shell builtin) respects PATH, and does not search .' (the current directory).

Change all the invocations which refer to files which are part of osstest to say . ./foo' instead of simply . foo'.

I have checked the results of
git-grep '^[ \t]*\. [^./]'
after this patch and the remaining five hits are of no concern.

Quoted 7 lines

As a double-check of my hand-editing, I have also done this
perl -i~ -pe 's#^(\s*\. )\./#$1#' *
and verified that the resulting tree is almost identical to that before this commit. There is one difference, where the original code already said `. ./job'.

I think there are good reasons for not simply adding . to $PATH at the top of the various scripts.

Quoted 446 lines
---
 ap-fetch-version               |    6 +++---
 ap-fetch-version-baseline      |    2 +-
 ap-fetch-version-baseline-late |    6 +++---
 ap-fetch-version-old           |    6 +++---
 ap-print-url                   |    6 +++---
 ap-push                        |    6 +++---
 ap-qemu-revision               |    4 ++--
 ap-qemu-url                    |    4 ++--
 cr-all-branch-statuses         |    2 +-
 cr-daily-branch                |    4 ++--
 cr-try-bisect                  |    4 ++--
 cr-try-bisect-adhoc            |    6 +++---
 cri-args-hostlists             |    6 +++---
 cri-common                     |    4 ++--
 cri-lock-repos                 |    2 +-
 make-distros-flight            |    6 +++---
 make-flight                    |    8 ++++----
 mg-all-branch-statuses         |    2 +-
 mg-cpu-microcode-update        |    4 ++--
 mg-debian-installer-update     |    4 ++--
 mg-debian-installer-update-all |    2 +-
 mg-execute-flight              |    2 +-
 mg-pxe-loader-update           |    4 ++--
 standalone                     |    2 +-
 standalone-reset               |    4 ++--
 25 files changed, 53 insertions(+), 53 deletions(-)
ap-fetch-version +3 -3
index 62adf79..086aa62 100755
@@ -20,10 +20,10 @@
 set -e
 
 branch=$1
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 if info_linux_tree "$branch"; then
 	repo_tree_rev_fetch_git linux \
ap-fetch-version-baseline +1 -1
index e693e16..8889d1e 100755
@@ -21,7 +21,7 @@ set -e
 
 branch=$1
 
-. cri-lock-repos
+. ./cri-lock-repos
 
 : ${BASE_TREE_LINUX:=git://xenbits.xen.org/people/ianc/linux-2.6.git}
 : ${BASE_TAG_LINUX:=xen/next-2.6.32}
ap-fetch-version-baseline renamed from ap-fetch-version-baseline-late +0 -1
-late

index ef1a8b1..3db443d 100755

ap-fetch-version-baseline-late +3 -3
@@ -22,10 +22,10 @@ set -e
 branch=$1
 new=$2
 
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 case "$branch" in
 
ap-fetch-version-old +3 -3
index 716fc8f..9d5487a 100755
@@ -20,10 +20,10 @@
 set -e
 
 branch=$1
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 : ${BASE_TAG_LINUX2639:=tested/2.6.39.x}
 : ${BASE_LOCALREV_LINUX:=daily-cron.$branch.old}
ap-print-url +3 -3
index c161169..1b178c7 100755
@@ -20,10 +20,10 @@
 set -e
 
 branch=$1
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
-. ap-common
+. ./ap-common
 
 if info_linux_tree "$branch"; then
 	echo $TREE_LINUX_THIS
ap-push +3 -3
index aa0ec3d..ea21887 100755
@@ -21,13 +21,13 @@ set -ex
 
 branch=$1
 revision=$2
-. cri-lock-repos
-. cri-common
+. ./cri-lock-repos
+. ./cri-common
 select_xenbranch
 
 : ${TAG_LINUX2639:=tested/2.6.39.x}
 
-. ap-common
+. ./ap-common
 
 TREE_LINUX=$PUSH_TREE_LINUX
 TREE_QEMU_MAINLINE=$PUSH_TREE_QEMU_MAINLINE
ap-qemu-revision +2 -2
index abfa650..de105ca 100755
@@ -22,8 +22,8 @@ set -e
 xenbranch=$1
 xenrevision=$2
 
-. cri-lock-repos
-. ap-common
+. ./cri-lock-repos
+. ./ap-common
 
 cd "$repos/xen"
 git cat-file blob $xenrevision:Config.mk | perl -ne '
ap-qemu-url +2 -2
index 1161a46..6ed704a 100755
@@ -21,7 +21,7 @@ set -e
 
 xenbranch=$1
 
-. cri-lock-repos
-. ap-common
+. ./cri-lock-repos
+. ./ap-common
 
 echo $TREE_QEMU
cr-all-branch-statuses +1 -1
index f9885db..f4ed46e 100755
@@ -18,7 +18,7 @@
 
 set -ex
 
-. cri-args-hostlists
+. ./cri-args-hostlists
 branch=$1; shift
 
 check_stop all-branch-statuses.
cr-daily-branch +2 -2
index dd9c30a..06f4b38 100755
@@ -19,8 +19,8 @@
 
 set -ex
 
-. cri-args-hostlists
-. ap-common
+. ./cri-args-hostlists
+. ./ap-common
 branch=$1; shift
 select_branch
 info_linux_tree $branch ||:
cr-try-bisect +2 -2
index 8f00537..06c4940 100755
@@ -19,8 +19,8 @@
 
 set -ex
 
-. cri-bisect
-. cri-args-hostlists
+. ./cri-bisect
+. ./cri-args-hostlists
 
 branch=$1; shift
 select_branch
cr-try-bisect-adhoc +3 -4
index c34c74c..4ff8b8c 100755
@@ -21,7 +21,7 @@ set -ex
 
 export OSSTEST_BLESSING=adhoc
 
-. cri-common
+. ./cri-common
 
 nope () { echo "nope: $*"; exit 0; }
 
@@ -34,8 +34,8 @@ if ! test -f job; then nope "no job"; exit 0; fi
 #   testid=
 #   bisect= list of args to cs-bisection-step, eg  '--fail
-flight=<mumble>'
 
-. cri-bisect
-. cri-args-hostlists
+. ./cri-bisect
+. ./cri-args-hostlists
 select_branch
 
 export OSSTEST_BLESSING=adhoc
cri-args-hostlists +3 -3
index 0dd2ef3..58a2252 100644
@@ -34,13 +34,13 @@ check_stop () {
 	check_stop_core "$1"
 	if test -f ${1}xsettings; then
 		echo "loading ${1}xsettings"
-		. ${1}xsettings
+		. ./${1}xsettings
 	fi
 }
 
 check_stop ''
 
-. cri-common
+. ./cri-common
 
 dcs=daily-cron-settings
 
@@ -56,7 +56,7 @@ fi
 
 : ${OSSTEST_EMAIL_HEADER:=daily-cron-email-$OSSTEST_BLESSING}
 
-. ${OSSTEST_CRON_SETTINGS:-$dcs-$OSSTEST_BLESSING}
+. ./${OSSTEST_CRON_SETTINGS:-$dcs-$OSSTEST_BLESSING}
 
 : ${OSSTEST_PUSH:=false}
 
cri-common +2 -2
index c874ff9..6dfe8df 100644
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-. cri-getconfig
+. ./cri-getconfig
 
 umask 002
 
@@ -101,6 +101,6 @@ select_branch () {
 	mrof="$branch.mro"
 
 	if test -f branch-settings.$branch; then
-		. branch-settings.$branch
+		. ./branch-settings.$branch
 	fi
 }
cri-lock-repos +1 -1
index c8269f3..e75e3f5 100644
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-. cri-common
+. ./cri-common
 
 repos=`getrepos`
 repos_lock="$repos/lock"
make-distros-flight +3 -3
index d407fcb..697a171 100755
@@ -26,9 +26,9 @@ buildflight=$4
 
 flight=`./cs-flight-create $blessing $branch`
 
-. cri-common
-. ap-common
-. mfi-common
+. ./cri-common
+. ./ap-common
+. ./mfi-common
 
 defsuite=`getconfig DebianSuite`
 defguestsuite=`getconfig GuestDebianSuite`
make-flight +4 -4
index 70c909d..8dc4e64 100755
@@ -26,10 +26,10 @@ buildflight=$4
 
 flight=`./cs-flight-create $blessing $branch`
 
-. cri-common
-. cri-getplatforms
-. ap-common
-. mfi-common
+. ./cri-common
+. ./cri-getplatforms
+. ./ap-common
+. ./mfi-common
 
 defsuite=`getconfig DebianSuite`
 defguestsuite=`getconfig GuestDebianSuite`
mg-all-branch-statuses +1 -1
index bba7216..74dc09a 100755
@@ -27,7 +27,7 @@
 
 set -e
 
-. cri-common
+. ./cri-common
 
 mkdir -p tmp
 
mg-cpu-microcode-update +2 -2
index c375a43..4d51dfb 100755
@@ -2,8 +2,8 @@
 
 set -e
 
-. cri-getconfig
-. mgi-common
+. ./cri-getconfig
+. ./mgi-common
 
 # iucode_tool is in /usr/sbin, see #788459.
 export PATH="/usr/local/sbin:$PATH:/sbin:/usr/sbin"
mg-debian-installer-update +2 -2
index 526cdf1..6070b8a 100755
@@ -21,8 +21,8 @@
 
 set -e
 
-. cri-getconfig
-. mgi-common
+. ./cri-getconfig
+. ./mgi-common
 
 suite=$1
 arch=$2
mg-debian-installer-update renamed from mg-debian-installer-update-all +0 -1
-all

index 241e2e3..1bbaef7 100755

mg-debian-installer-update-all +1 -1
@@ -20,7 +20,7 @@
 
 set -e
 
-. cri-getconfig
+. ./cri-getconfig
 
 suite=`getconfig DebianSuite`
 fws=`getconfig DebianNonfreeFirmware`
mg-execute-flight +1 -1
index 7f3d969..0d8c792 100755
@@ -48,7 +48,7 @@ while [ $# != 0 ]; do
 	esac
 done
 
-. cri-getconfig
+. ./cri-getconfig
 
 if [ x"$flight" = x ]; then badusage; fi
 
mg-pxe-loader-update +2 -2
index 386e449..9774350 100755
@@ -23,8 +23,8 @@
 
 set -e
 
-. cri-getconfig
-. mgi-common
+. ./cri-getconfig
+. ./mgi-common
 
 suite=$1
 
standalone +1 -1
index 60b6666..9383d72 100755
@@ -123,7 +123,7 @@ while true ; do
     esac
 done
 
-. cri-getconfig
+. ./cri-getconfig
 
 WebspaceLog=`OSSTEST_CONFIG=$config getconfig WebspaceLog`
 if [ ! -r "$WebspaceLog" ] ; then
standalone-reset +2 -2
index 8555039..0a69915 100755
@@ -37,10 +37,10 @@ done
 shift $((OPTIND-1))
 
 if [ -f standalone.config ] ; then
-    . standalone.config
+    . ./standalone.config
 fi
 
-. cri-getconfig
+. ./cri-getconfig
 
 jobdb=`getconfig JobDB`
 if [ "$jobdb" != Standalone ]; then
#3 lore raw

PATCH 3/3 Shell fixup: Use bash in posix mode

In reply to Ian Jackson

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.

---
 ap-fetch-version                        |    2 +-
 ap-fetch-version-baseline               |    2 +-
 ap-fetch-version-baseline-late          |    2 +-
 ap-fetch-version-old                    |    2 +-
 ap-print-url                            |    2 +-
 ap-push                                 |    2 +-
 ap-qemu-revision                        |    2 +-
 ap-qemu-url                             |    2 +-
 cr-all-branch-statuses                  |    2 +-
 cr-daily-branch                         |    2 +-
 cr-for-branches                         |    2 +-
 cr-try-bisect                           |    2 +-
 cr-try-bisect-adhoc                     |    2 +-
 cri-getprevxenbranch                    |    2 +-
 invoke-daemon                           |    4 +++-
 make-distros-flight                     |    2 +-
 make-flight                             |    2 +-
 mg-adjust-flight-makexrefs              |    2 +-
 mg-all-branch-statuses                  |    2 +-
 mg-branch-setup                         |    2 +-
 mg-cpu-microcode-update                 |    2 +-
 mg-debian-installer-update              |    2 +-
 mg-debian-installer-update-all          |    2 +-
 mg-execute-flight                       |    2 +-
 mg-pxe-loader-update                    |    2 +-
 mg-update-live                          |    2 +-
 sa-forget-flight                        |    2 +-
 sa-init-db                              |    2 +-
 sg-hg-heads                             |    2 +-
 standalone                              |    2 +-
 standalone-generate-dump-flight-runvars |    2 +-
 standalone-reset                        |    2 +-
 32 files changed, 34 insertions(+), 32 deletions(-)
ap-fetch-version +1 -1
index 086aa62..6fa7588 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 . ./cri-lock-repos
ap-fetch-version-baseline +1 -1
index 8889d1e..2e42508 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 
ap-fetch-version-baseline-late +1 -1
index 3db443d..9856ec9 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 new=$2
ap-fetch-version-old +1 -1
index 9d5487a..66d51f8 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 . ./cri-lock-repos
ap-print-url +1 -1
index 1b178c7..4088852 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 . ./cri-lock-repos
ap-push +1 -1
index ea21887..d2195f2 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -ex
+set -ex -o posix
 
 branch=$1
 revision=$2
ap-qemu-revision +1 -1
index de105ca..d08cffe 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 xenbranch=$1
 xenrevision=$2
ap-qemu-url +1 -1
index 6ed704a..61598f6 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 xenbranch=$1
 
cr-all-branch-statuses +1 -1
index f4ed46e..46028ba 100755
@@ -16,7 +16,7 @@
 # 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
cr-daily-branch +1 -1
index 06f4b38..c7cc33b 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -ex
+set -ex -o posix
 
 . ./cri-args-hostlists
 . ./ap-common
cr-for-branches +1 -1
index 8d5748b..757045d 100755
@@ -20,7 +20,7 @@
 
 
 
-set -e
+set -e -o posix
 
 export FOR_LOGFILE="$*"
 
cr-try-bisect +1 -1
index 06c4940..2a5fe09 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -ex
+set -ex -o posix
 
 . ./cri-bisect
 . ./cri-args-hostlists
cr-try-bisect-adhoc +1 -1
index 4ff8b8c..5f8b7e1 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -ex
+set -ex -o posix
 
 export OSSTEST_BLESSING=adhoc
 
cri-getprevxenbranch +1 -1
index 308b0c7..a70138e 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -e
+set -e -o posix
 
 xenbranch=$1
 p=
invoke-daemon +3 -1
index 5fab1da..ad1434a 100755
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash
 
 # This is part of "osstest", an automated testing framework for Xen.
 # Copyright (C) 2009-2013 Citrix Inc.
@@ -16,6 +16,8 @@
 # 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
make-distros-flight +1 -1
index 697a171..90e28c3 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 xenbranch=$2
make-flight +1 -1
index 8dc4e64..8c75a9c 100755
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 branch=$1
 xenbranch=$2
mg-adjust-flight-makexrefs +1 -1
index ebbac15..ec555bc 100755
@@ -22,7 +22,7 @@
 #             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=''
mg-all-branch-statuses +1 -1
index 74dc09a..d3e437f 100755
@@ -25,7 +25,7 @@
 # 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
 
mg-branch-setup +1 -1
index f8bcb2e..6a9bd3f 100755
@@ -15,7 +15,7 @@
 #  - 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'; }
mg-cpu-microcode-update +1 -1
index 4d51dfb..1032025 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -e
+set -e -o posix
 
 . ./cri-getconfig
 . ./mgi-common
mg-debian-installer-update +1 -1
index 6070b8a..7e3fb20 100755
@@ -19,7 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 . ./cri-getconfig
 . ./mgi-common
mg-debian-installer-update-all +1 -1
index 1bbaef7..4e76a69 100755
@@ -18,7 +18,7 @@
 # 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
 
mg-execute-flight +1 -1
index 0d8c792..8b2c21c 100755
@@ -29,7 +29,7 @@ usage () { cat <<END
 END
 }
 
-set -e
+set -e -o posix
 
 publish=false
 
mg-pxe-loader-update +1 -1
index 9774350..e0e347d 100755
@@ -21,7 +21,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set -e
+set -e -o posix
 
 . ./cri-getconfig
 . ./mgi-common
mg-update-live +1 -1
index f1d24cd..3ff7ffa 100755
@@ -22,7 +22,7 @@
 #  cd ~osstest
 #  for f in branches/*.git; do ./update-live 3c464fbf8a05b24f4afb7e58bcf4ae77fbb7ad0c $f; done
 
-set -e
+set -e -o posix
 bad="$1"
 dir="$2"
 
sa-forget-flight +1 -1
index 8b005f1..1c3ecb2 100755
@@ -16,7 +16,7 @@
 # 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
sa-init-db +1 -1
index 37ab4be..bd9aa4a 100755
@@ -16,7 +16,7 @@
 # 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
sg-hg-heads +1 -1
index 41ec734..b2dd601 100755
@@ -21,7 +21,7 @@
 #  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`
standalone +1 -1
index 9383d72..168a46c 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -e
+set -e -o posix
 
 usage() {
     cat >&2 <<EOF
standalone-generate-dump-flight-runvars +1 -1
index da3c0f8..d113927 100755
@@ -24,7 +24,7 @@
 # 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
 
standalone-reset +1 -1
index 0a69915..e58ba68 100755
@@ -16,7 +16,7 @@
 # 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
Signature · 1 line
1.7.10.4
Acked-by on v1 3/3
#4 lore raw

Re: [OSSTEST PATCH 3/3] Shell fixup: Use bash in posix mode

Quoted 4 lines · Ian Jackson

I have read through the wheezy
bash(1) manpage and searched for posix, and the following behavioural differences are described:

Quoted 8 lines

* 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.

I expected this to also disable "[[ expression ]]", "$((maths))", array variables and in particular $PIPESTATUS too, but it looks like I was wrong and it doesn't disable bash _extensions_, just areas where bash differs from what posix specifies.

Of those we seem to use $((maths)) and $PIPESTATUS (once in the standalone wrapper), although array variables are tricky to grep for.

I also found http://tiswww.case.edu/php/chet/bash/POSIX (referenced from the manpage) handy.

Quoted 3 lines

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.

Agreed.

Quoted 1 line