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 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 18:39:18 +02:00
commit c62eeac548

View file

@ -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