#!/usr/bin/env bash # ============================================================================ # Capture an execution trace of a shell script with every mutating command # stubbed, so a split can be verified by RUNNING it rather than by sourcing it. # # Why this exists: verify_shell_split.sh sources the libs and never calls them, # which proves `source` lines resolve and nothing more. The analyze_repo.sh # split passed that, plus bash -n, shellcheck and a function-set diff, and # still shipped a script that aborted after language detection -- a `set -e` # function-tail return and a self-referencing nameref, neither reachable # without execution. See docs/shell-split-verification.md. # # The trace is the artifact: run this at the pre-split commit and again after # the split, then diff. An identical trace means the same commands ran in the # same order with the same arguments. # # Mutating binaries are shadowed by stubs earlier on PATH, so the live system # is never touched. That is what makes this safe for the enforcement and # installer scripts Decision 6 forbids executing for real. # # Scripts whose job is PLACING FILES need --prefix: shell redirections cannot # be stubbed via PATH, so without it the choice is an empty trace or a rewritten # live system. See lib/trace_prefix.sh for the two layers that solves. # # Usage: # trace_shell_split.sh