From 18181ec5dd8042fc27ecdbd1a243fd331f75736c Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 18 Nov 2024 15:47:15 -0500 Subject: [PATCH] ci: Set `-u` (error on unset) in all script files This is a pretty common flag to reduce errors. Make use of it here. (backport ) (cherry picked from commit 59a18de777622bccd8be5afce1248cfbfd32f607) --- ci/android-install-ndk.sh | 2 +- ci/android-install-sdk.sh | 2 +- ci/android-sysimage.sh | 2 +- ci/build.sh | 2 +- ci/docker/wasm32-unknown-emscripten/node-wrapper.sh | 2 +- ci/emscripten-entry.sh | 2 +- ci/emscripten.sh | 2 +- ci/install-musl.sh | 2 +- ci/install-rust.sh | 2 +- ci/linux-s390x.sh | 2 +- ci/linux-sparc64.sh | 2 +- ci/run-docker.sh | 2 +- ci/run.sh | 2 +- ci/style.sh | 2 +- ci/test-runner-linux | 2 +- ci/wasi.sh | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index eb666e2db5da1..546917b5f8d53 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -set -ex +set -eux ndk=android-ndk-r27 wget --tries=20 -q "https://dl.google.com/android/repository/${ndk}-linux.zip" diff --git a/ci/android-install-sdk.sh b/ci/android-install-sdk.sh index b7f2b8e1443fc..331e061357648 100644 --- a/ci/android-install-sdk.sh +++ b/ci/android-install-sdk.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -set -ex +set -eux # Prep the SDK and emulator # diff --git a/ci/android-sysimage.sh b/ci/android-sysimage.sh index b49712035cf33..98484b3521f60 100644 --- a/ci/android-sysimage.sh +++ b/ci/android-sysimage.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -ex +set -eux URL=https://dl.google.com/android/repository/sys-img/android diff --git a/ci/build.sh b/ci/build.sh index 0239309ddf355..78556b6f7a8fc 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -5,7 +5,7 @@ # The FILTER environment variable can be used to select which target(s) to build. # For example: set FILTER to vxworks to select the targets that has vxworks in name -set -ex +set -eux : "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}" : "${OS?The OS environment variable must be set.}" diff --git a/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh index 369439269a683..0fd93dc49d9c8 100755 --- a/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh +++ b/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -e +set -eux me="$1" shift diff --git a/ci/emscripten-entry.sh b/ci/emscripten-entry.sh index e950cbe33ab06..344c347b75a72 100755 --- a/ci/emscripten-entry.sh +++ b/ci/emscripten-entry.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -ex +set -eux # shellcheck disable=SC1091 source /emsdk-portable/emsdk_env.sh &> /dev/null diff --git a/ci/emscripten.sh b/ci/emscripten.sh index b17a40c1a287d..0a4112e7e205e 100644 --- a/ci/emscripten.sh +++ b/ci/emscripten.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -ex +set -eux # Note: keep in sync with: # https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh diff --git a/ci/install-musl.sh b/ci/install-musl.sh index fae46ee928c9f..5f8c681fa6678 100644 --- a/ci/install-musl.sh +++ b/ci/install-musl.sh @@ -3,7 +3,7 @@ # Install musl and musl-sanitized linux kernel headers # to musl-{$1} directory -set -ex +set -eux musl_version=1.1.24 musl="musl-${musl_version}" diff --git a/ci/install-rust.sh b/ci/install-rust.sh index a0b841807b106..0438ee4f9f6fe 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh # This is intended to be used in CI only. -set -ex +set -eux echo "Setup toolchain" toolchain= diff --git a/ci/linux-s390x.sh b/ci/linux-s390x.sh index 63d29b5beb597..5c89e90b11906 100644 --- a/ci/linux-s390x.sh +++ b/ci/linux-s390x.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -set -ex +set -eux mkdir -m 777 /qemu cd /qemu diff --git a/ci/linux-sparc64.sh b/ci/linux-sparc64.sh index a42218a62ead0..d81ed104277a9 100644 --- a/ci/linux-sparc64.sh +++ b/ci/linux-sparc64.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -set -ex +set -eux mkdir -m 777 /qemu cd /qemu diff --git a/ci/run-docker.sh b/ci/run-docker.sh index a812ee7ab183a..a4a34be6b4f4a 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -6,7 +6,7 @@ # Small script to run tests for a target (or all targets) inside all the # respective docker images. -set -ex +set -eux # Default to assuming the CARGO_HOME is one directory up (to account for a `bin` # subdir) from where the `cargo` binary in `$PATH` lives. diff --git a/ci/run.sh b/ci/run.sh index e01dd3c14a574..caf4eb4333281 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -3,7 +3,7 @@ # Builds and runs tests for a particular target passed as an argument to this # script. -set -ex +set -eux mirrors_url="https://ci-mirrors.rust-lang.org/libc" diff --git a/ci/style.sh b/ci/style.sh index 53efb82280c87..d1b639db5bb89 100755 --- a/ci/style.sh +++ b/ci/style.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -ex +set -eux if [ -n "${CI:-}" ]; then rustup toolchain install nightly -c rustfmt --allow-downgrade diff --git a/ci/test-runner-linux b/ci/test-runner-linux index 9ab029b0a7df2..55f84da1700f7 100755 --- a/ci/test-runner-linux +++ b/ci/test-runner-linux @@ -1,6 +1,6 @@ #!/bin/sh -set -e +set -eux arch="$1" prog="$2" diff --git a/ci/wasi.sh b/ci/wasi.sh index 1b72d356fac06..e7896233ad7f3 100644 --- a/ci/wasi.sh +++ b/ci/wasi.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -ex +set -eux apt-get update apt-get install -y --no-install-recommends \