### concurrent trigger # Two isolated source trees (A and B) were supplied to independent helper builds sharing dist/helpers. # The deterministic Zig fixture delayed A/Oliver and B/Boris to force overlap; the lipo fixture copied # the generated helper markers into the shared output. rm -rf /tmp/banal-race /tmp/banal-race-work mkdir -p /tmp/banal-race/{A,B}/{oliver,boris} /tmp/banal-race-work/bin touch /tmp/banal-race/{A,B}/{oliver,boris}/build.zig cat > /tmp/banal-race-work/bin/zig <<'SH' #!/bin/bash set -u prefix= prev= for arg in "$@"; do if [ "$prev" = "--prefix" ]; then prefix="$arg"; fi prev="$arg" done name="$(basename "$PWD")" root="$(basename "$(dirname "$PWD")")" if [ "$root" = A ] && [ "$name" = oliver ]; then sleep 0.3; fi if [ "$root" = B ] && [ "$name" = boris ]; then sleep 0.3; fi mkdir -p "$prefix/bin" printf 'source=%s helper=%s target=%s\n' "$root" "$name" "${TARGET:-host}" > "$prefix/bin/$name" chmod +x "$prefix/bin/$name" SH chmod +x /tmp/banal-race-work/bin/zig cat > /tmp/banal-race-work/bin/lipo <<'SH' #!/bin/bash output="${@: -1}" : > "$output" for f in "${@:1:$#-1}"; do cat "$f" >> "$output"; done chmod +x "$output" SH chmod +x /tmp/banal-race-work/bin/lipo rm -rf dist/helpers mkdir -p dist/helpers (PATH="/tmp/banal-race-work/bin:$PATH" OLIVER_DIR=/tmp/banal-race/A/oliver BORIS_DIR=/tmp/banal-race/A/boris ZIG=/tmp/banal-race-work/bin/zig make helpers > /tmp/race-A.log 2>&1) & a=$! (PATH="/tmp/banal-race-work/bin:$PATH" OLIVER_DIR=/tmp/banal-race/B/oliver BORIS_DIR=/tmp/banal-race/B/boris ZIG=/tmp/banal-race-work/bin/zig make helpers > /tmp/race-B.log 2>&1) & b=$! wait "$a"; sa=$? wait "$b"; sb=$? ### final output readback A_exit=0 B_exit=0 dist/helpers/oliver: source=A helper=oliver target=host source=A helper=oliver target=host dist/helpers/boris: source=B helper=boris target=host source=A helper=boris target=host source=B helper=boris target=host source=A helper=boris target=host tmp_files=none ### source publication path # Scripts/helpers.sh:73-84 uses a private compiler directory but publishes each lipo result to the # shared $HELPERS/$name.tmp and then moves it to shared $HELPERS/$name. tmp="$(mktemp -d)" if (cd "$src" && "$ZIG" build --prefix "$arm" -Doptimize=ReleaseSafe -Dtarget=aarch64-macos) && (cd "$src" && "$ZIG" build --prefix "$x86" -Doptimize=ReleaseSafe -Dtarget=x86_64-macos); then if [ -f "$arm/bin/$name" ] && [ -f "$x86/bin/$name" ] && lipo -create "$arm/bin/$name" "$x86/bin/$name" -output "$HELPERS/$name.tmp"; then mv "$HELPERS/$name.tmp" "$HELPERS/$name" fi fi # Scripts/helpers.sh:90-103 can also copy or remove the same shared final path during host fallback. cp "$tmp/bin/$name" "$HELPERS/$name" ... rm -f "$HELPERS/$name" # Scripts/helpers.sh:107-117 processes oliver and boris independently, without an invocation-level lock # or pair-level publication. Makefile:33-35 exposes this script directly as `make helpers`. for tool in oliver boris; do ... build_helper "$tool" "$src" done ### final result # final result: BF-RACE-1 failed. Both concurrent commands returned success, but the shared Boris output # contains provenance from both source trees while Oliver and Boris were published independently.