Skip to content

Commit 04d47e9

Browse files
szedergitster
authored andcommitted
travis-ci: use 'set -e' in the 32 bit Linux build job
The script 'ci/run-linux32-build.sh' running inside the Docker container of the 32 bit Linux build job uses an && chain to break the build if one of the commands fails. This is problematic for two reasons: - The && chain is broken, because there is this in the middle: test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) && Luckily it is broken in a way that it didn't lead to false successes. If installing dependencies fails, then the rest of the first && chain is skipped and execution resumes after the || operator. At that point $HOST_UID is still unset, causing 'useradd' to error out with "invalid user ID 'ci'", which in turn causes the second && chain to abort the script and thus break the build. - All other 'ci/*' scripts use 'set -e' to break the build if one of the commands fails. This inconsistency among these scripts is asking for trouble: I forgot about the && chain more than once while working on this patch series. Enable 'set -e' for the whole script and for the commands executed under 'su' as well. While touching every line in the 'su' command block anyway, change their indentation to use a tab instead of spaces. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f63b123 commit 04d47e9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ci/run-linux32-build.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
# run-linux32-build.sh [host-user-id]
77
#
88

9-
set -x
9+
set -ex
1010

1111
# Update packages to the latest available versions
1212
linux32 --32bit i386 sh -c '
1313
apt update >/dev/null &&
1414
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
1515
libexpat-dev gettext python >/dev/null
16-
' &&
16+
'
1717

1818
# If this script runs inside a docker container, then all commands are
1919
# usually executed as root. Consequently, the host user might not be
2020
# able to access the test output files.
2121
# If a host user id is given, then create a user "ci" with the host user
2222
# id to make everything accessible to the host user.
23-
HOST_UID=$1 &&
24-
CI_USER=$USER &&
25-
test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) &&
23+
HOST_UID=$1
24+
CI_USER=$USER
25+
test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER)
2626

2727
# Build and test
2828
linux32 --32bit i386 su -m -l $CI_USER -c '
29-
set -x &&
30-
cd /usr/src/git &&
31-
ln -s /tmp/travis-cache/.prove t/.prove &&
32-
make --jobs=2 &&
33-
make --quiet test
29+
set -ex
30+
cd /usr/src/git
31+
ln -s /tmp/travis-cache/.prove t/.prove
32+
make --jobs=2
33+
make --quiet test
3434
'

0 commit comments

Comments
 (0)