Skip to content

Commit f92da8e

Browse files
authored
Merge pull request #4108 from tgross35/set-u
Set `-u` (error on unset) in all script files
2 parents 22d4318 + 331dd50 commit f92da8e

16 files changed

+34
-37
lines changed

ci/android-install-ndk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
ndk=android-ndk-r27
66
wget --tries=20 -q "https://dl.google.com/android/repository/${ndk}-linux.zip"

ci/android-install-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
# Prep the SDK and emulator
66
#

ci/android-sysimage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
URL=https://dl.google.com/android/repository/sys-img/android
66

ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# The FILTER environment variable can be used to select which target(s) to build.
66
# For example: set FILTER to vxworks to select the targets that has vxworks in name
77

8-
set -ex
8+
set -eux
99

1010
: "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}"
1111
: "${OS?The OS environment variable must be set.}"

ci/docker/wasm32-unknown-emscripten/node-wrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
set -e
3+
set -eux
44

55
me="$1"
66
shift

ci/emscripten-entry.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
# shellcheck disable=SC1091
66
source /emsdk-portable/emsdk_env.sh &> /dev/null

ci/emscripten.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
# Note: keep in sync with:
66
# https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh

ci/install-musl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Install musl and musl-sanitized linux kernel headers
44
# to musl-{$1} directory
55

6-
set -ex
6+
set -eux
77

88
musl_version=1.1.24
99
musl="musl-${musl_version}"

ci/install-rust.sh

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#!/usr/bin/env sh
22
# This is intended to be used in CI only.
33

4-
set -ex
4+
set -eux
55

66
echo "Setup toolchain"
7-
toolchain=
8-
if [ -n "$TOOLCHAIN" ]; then
9-
toolchain=$TOOLCHAIN
10-
else
11-
toolchain=nightly
12-
fi
137

14-
if [ "$OS" = "windows" ]; then
8+
toolchain="${TOOLCHAIN:-nightly}"
9+
os="${OS:-}"
10+
11+
if [ "$os" = "windows" ]; then
1512
: "${TARGET?The TARGET environment variable must be set.}"
1613
rustup set profile minimal
1714
rustup update --force "$toolchain-$TARGET"
@@ -22,18 +19,18 @@ else
2219
rustup default "$toolchain"
2320
fi
2421

25-
if [ -n "$TARGET" ]; then
22+
if [ -n "${TARGET:-}" ]; then
2623
echo "Install target"
2724
rustup target add "$TARGET"
2825
fi
2926

30-
if [ -n "$INSTALL_RUST_SRC" ]; then
27+
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
3128
echo "Install rust-src"
3229
rustup component add rust-src
3330
fi
3431

35-
if [ "$OS" = "windows" ]; then
36-
if [ "$ARCH_BITS" = "i686" ]; then
32+
if [ "$os" = "windows" ]; then
33+
if [ "${ARCH_BITS:-}" = "i686" ]; then
3734
echo "Install MinGW32"
3835
choco install mingw --x86 --force
3936
fi
@@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
4441
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
4542
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"
4643

47-
if [ -n "$ARCH_BITS" ]; then
44+
if [ -n "${ARCH_BITS:-}" ]; then
4845
echo "Fix MinGW"
4946
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
5047
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"

ci/linux-s390x.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
mkdir -m 777 /qemu
66
cd /qemu

ci/linux-sparc64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
mkdir -m 777 /qemu
66
cd /qemu

ci/run-docker.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Small script to run tests for a target (or all targets) inside all the
77
# respective docker images.
88

9-
set -ex
9+
set -eux
1010

1111
# Default to assuming the CARGO_HOME is one directory up (to account for a `bin`
1212
# subdir) from where the `cargo` binary in `$PATH` lives.
@@ -89,13 +89,13 @@ build_switch() {
8989
}
9090

9191
if [ -z "${1}" ]; then
92-
for d in ci/docker/*; do
93-
run "${d}"
94-
done
92+
for d in ci/docker/*; do
93+
run "${d}"
94+
done
9595
else
96-
if [ "${1}" != "switch" ]; then
97-
run "${1}"
98-
else
99-
build_switch
100-
fi
96+
if [ "${1}" != "switch" ]; then
97+
run "${1}"
98+
else
99+
build_switch
100+
fi
101101
fi

ci/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Builds and runs tests for a particular target passed as an argument to this
44
# script.
55

6-
set -ex
6+
set -eux
77

88
mirrors_url="https://ci-mirrors.rust-lang.org/libc"
99

@@ -15,7 +15,7 @@ target="$1"
1515
#
1616
# It's assume that all images, when run with two disks, will run the `run.sh`
1717
# script from the second which we place inside.
18-
if [ "$QEMU" != "" ]; then
18+
if [ -n "${QEMU:-}" ]; then
1919
tmpdir=/tmp/qemu-img-creation
2020
mkdir -p "${tmpdir}"
2121

ci/style.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
set -ex
3+
set -eux
44

55
rustc ci/style.rs && ./style src
66

ci/test-runner-linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
set -e
3+
set -eux
44

55
arch="$1"
66
prog="$2"

ci/wasi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
apt-get update
66
apt-get install -y --no-install-recommends \

0 commit comments

Comments
 (0)