lib.sh: bs_pin gives an empty pin for a tree without rust-toolchain.toml (a failed sed under pipefail ended the caller silently)

The b3c228fa builds under the 0.3.16 app tree 5d118f58 (no rust-toolchain.toml yet) died right after the pairing line with no
message: sed on the missing file failed, pipefail carried its status into the assignment, set -e ended the script. A guard and a
tolerant pipeline; checked alive against a tree without the file.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-josh 2026-10-07 04:44:26 +01:00
parent 8820beadbc
commit 607a7433c3

View file

@ -45,7 +45,10 @@ bs_rsync() { rsync -e "$BS_SSH_CMD" "$@"; }
# a different compiler gives different bytes and, across a minor version, different lints and errors
# the pin (main, 7 October 2026): rust-toolchain.toml at the worktree root (and the fork's own copy) names the channel; the Mac's
# rustc AS RESOLVED IN THE CRATE DIR (rustup reads the file), the box's rustc and the pin must agree, else the build is refused
bs_pin() { sed -n 's/^channel *= *"\([^"]*\)".*/\1/p' "${1:-$BS_WT_ROOT}/rust-toolchain.toml" 2>/dev/null | head -1; }
# a tree without the file (an older release branch) gives an empty pin, never a failed pipeline: under pipefail the sed status would
# become the assignment's status and set -e would end the caller silently (7 Oct 2026, 03:36 UTC: the b3c228fa builds under the
# 0.3.16 app tree 5d118f58 died right after the pairing line)
bs_pin() { local f="${1:-$BS_WT_ROOT}/rust-toolchain.toml"; [ -f "$f" ] || { echo ""; return 0; }; { sed -n 's/^channel *= *"\([^"]*\)".*/\1/p' "$f" 2>/dev/null || true; } | head -1; }
bs_toolchain_check() {
local mac box pin
pin=$(bs_pin "$BS_WT_ROOT"); [ -n "$pin" ] || pin=$(bs_pin "$BS_TOP")