test: cli.sh reads fixtures, not the host it happens to run on #137

Merged
andres merged 3 commits from build/136-cli-hermetic into main 2026-07-31 21:24:04 +00:00
Showing only changes of commit 7385707770 - Show all commits

View file

@ -3308,7 +3308,17 @@ check "hermetic: cibox_run() seals the real /usr/local/bin lookup" 0 "" cibox_ru
# The failed-logout check builds its own env rather than calling undo(), so it # The failed-logout check builds its own env rather than calling undo(), so it
# needs the same seal — and it is the one that was missed first time round. # needs the same seal — and it is the one that was missed first time round.
inline_undo_is_sealed() { inline_undo_is_sealed() {
grep -A 4 'failed logout is loud' "$0" | grep -q 'RIG_FORGEJO_RUNNER_DIR=' # Locate the REAL check by line number and read only its own block. Anchoring
# on a string and grepping the whole file cannot work here: any pattern this
# function searches for necessarily appears inside this function, so the
# search matches itself and can never fail. kimi caught the first version of
# that on !137; the anchored second version had the identical flaw for the
# identical reason. head -1 takes the real check (~:202), never this body.
local start end
start="$(grep -n 'failed logout is loud' "$0" | head -1 | cut -d: -f1)"
[ -n "$start" ] || return 1
end=$((start + 5))
sed -n "${start},${end}p" "$0" | grep -q RIG_FORGEJO_RUNNER_DIR
} }
check "hermetic: the hand-rolled undo invocation is sealed too" 0 "" inline_undo_is_sealed check "hermetic: the hand-rolled undo invocation is sealed too" 0 "" inline_undo_is_sealed