checkers-test: run section 5b on the hermetic utilbin PATH

Section 5b (the bash 5.1 floor, #237) was written on a branch cut before the
NixOS-runner change (af44653f). That change moved section 5 off /usr/bin:/bin,
because on NixOS that path holds only env and sh. The two merged with no
conflict. On NixOS the runner then dies on `dirname` with exit 1, which turned
the KB job red on every PR at 666de199.

5b now uses utilbin too, and utilbin gains head and env for the 5.1 control.
Evidence and rivals: context/test-evidence/tooling.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Edward Langley
2026-09-23 23:14:30 -07:00
parent 666de19963
commit 4989bd55f7
2 changed files with 34 additions and 3 deletions
+4 -3
View File
@@ -136,9 +136,10 @@ chmod +x "$work/fakebin/bash"
# utilbin carries only the utilities the runner itself needs, and no nix, so
# the fake bash is the only candidate and the nix fallback is absent. Linked
# one by one rather than taking /usr/bin:/bin, which on NixOS hold only `env`
# and `sh` -- the runner died on `dirname` there, exit 1 instead of 3.
# and `sh` -- the runner died on `dirname` there, exit 1 instead of 3. `head`
# and `env` are for 5b's 5.1 control, which runs past the version check.
mkdir -p "$work/utilbin"
for tool in dirname; do
for tool in dirname head env; do
ln -sf "$(command -v "$tool")" "$work/utilbin/$tool"
done
env PATH="$work/fakebin:$work/utilbin" HOME="$HOME" \
@@ -154,7 +155,7 @@ for v in "5 0:3:a bash 5.0 with no nix is exit 3, not 5.x" \
printf '#!/bin/sh\ncase "$*" in *BASH_VERSINFO*) echo %s; exit 0 ;; esac\nexit 0\n' \
"${v%%:*}" > "$work/fakebin/bash"
want="${v#*:}"; name="${want#*:}"; want="${want%%:*}"
env PATH="$work/fakebin:/usr/bin:/bin" HOME="$HOME" \
env PATH="$work/fakebin:$work/utilbin" HOME="$HOME" \
"${BASH:-bash}" "$d/checkers.sh" any > "$work/out" 2>&1
got=$?
[ "$got" = "$want" ] && ok "$name" || bad "$name" "exit $got, wanted $want"