From c62eeac5484b1f8a4cd9a14c45222307f0250de9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 18:39:18 +0200 Subject: [PATCH] ygg-verify: carry pipefail to child shells via BASH_ENV, not SHELLOPTS Exporting SHELLOPTS also exported a job's own `set -u` to every bash-wrapped tool; kotlinc died on `JAVA_OPTS: unbound variable` (put-serve Hands, 2026-09-30). Probed on Yggdrasil: `false | cat` in a child script still returns 1, and a parent's `set -u` no longer reaches child shells. Co-Authored-By: Claude Opus 5.5 --- tools/stopgap/ygg-verify.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/stopgap/ygg-verify.sh b/tools/stopgap/ygg-verify.sh index 0b4ee67..372728f 100644 --- a/tools/stopgap/ygg-verify.sh +++ b/tools/stopgap/ygg-verify.sh @@ -46,8 +46,11 @@ # 2026-09-22. Mutation testing uses the ecosystem's tools on a cut's diff. # # TWO RAKES, both paid for on 2026-09-23: -# * The command runs under `bash -o pipefail -c`, and SHELLOPTS=pipefail is exported -# into the container, so a job SCRIPT run as `bash job.sh` inherits pipefail too +# * The command runs under `bash -o pipefail -c`, and BASH_ENV points every child +# bash at a file holding `set -o pipefail`, so a job SCRIPT run as `bash job.sh` +# inherits pipefail too. (Exporting SHELLOPTS did that but also leaked a job's +# `set -u` into bash-wrapped tools: kotlinc died on `JAVA_OPTS: unbound variable`, +# 2026-09-30.) # (the -o flag alone does not reach child shells; Soul proved a failing piped # test in a job script came back exit 0, 2026-09-30). Pipefail forced since # 2026-09-30, after an ack Cut 2 job piped a failing test run into `cut` and @@ -184,10 +187,10 @@ set +e sudo nice -n 10 docker run --rm --name "$cname" --cpus="$cpus" --memory="$mem" \ -v "$work:/src" -v /etc/machine-id:/etc/machine-id:ro \ -v eureka-cargo-registry:/usr/local/cargo/registry -v eureka-nuget:/root/.nuget/packages \ - -e CARGO_TARGET_DIR=/src/target -e SHELLOPTS=pipefail \ + -e CARGO_TARGET_DIR=/src/target -e BASH_ENV=/tmp/.ygg-bash-env \ -e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e GIT_CONFIG_VALUE_0='*' \ $docker_args \ - -w /src "$image" bash -o pipefail -c "$cmd" + -w /src "$image" bash -o pipefail -c "printf 'set -o pipefail\n' >/tmp/.ygg-bash-env; $cmd" status=$? set -e pkill -P "$watchdog" 2>/dev/null || true