mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 20:54:00 +01:00
929 -> 217 lines across five pw_*.sh libraries. This file IS /usr/bin/pacman here (the symlink points at the deployed copy), so the design constraint was not readability but that no failure mode may leave the machine unable to install packages. Fail OPEN, unlike the other splits in this campaign. A missing lib warns on stderr and execs real pacman unwrapped. Failing closed would mean a missing lib leaves no way to install anything, including the missing lib. This is the same choice the existing pacman_lock_lib.sh block already makes, and it is verified rather than asserted: with pw_guard.sh removed from a scratch-dir copy, the wrapper warns, execs, and returns real `-Qi bash` output at rc=0. The libs load at the very top, before the fast path, because the fast path calls needs_unlock() to decide whether to exec straight through, and that function now lives in pw_guard.sh. They are deployed flat beside the wrapper — the shape pacman_lock_lib.sh and heavy_job_lock.sh already use in /usr/local/bin — as required copies, and are added to the integrity manifest. Tamper detection was round-tripped in a fake root: 8 manifest entries verify clean, and appending one line to pw_challenge.sh is detected and the transaction denied. Verified by execution, not just textually: real `-Qi bash` and `-Q` through the split wrapper are byte-identical to the pre-split baseline, same 2824 packages. verify_shell_split.sh reports all 14 top-level functions moved verbatim. The deployed copy is deliberately NOT updated by this commit and still hashes 548fc2b5... exactly as before the work started; live pacman is unaffected. A live `pacman -S` remains unverified — the Bash tool deadlocks on db.lck and a failed experiment costs the package manager. Cap is now down to one file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3PzGc75gBcdxP3PkHXGcV
20 lines
1.7 KiB
JSON
20 lines
1.7 KiB
JSON
{
|
|
"title": "Split pacman_wrapper.sh under the 250-line cap",
|
|
"objective": "Bring pacman_wrapper.sh (929 lines) under the cap by moving its 31 functions into five flat-deployed libraries, without any failure mode that could leave this machine without a working package manager — /usr/bin/pacman is a symlink to the deployed copy.",
|
|
"acceptance_criteria": [
|
|
"The entry script and all five pw_*.sh libs are at most 250 lines.",
|
|
"Real read-only pacman queries through the split wrapper (-Qi bash, -Q) are byte-identical to the pre-split baseline.",
|
|
"A missing library FAILS OPEN: warning on stderr, exec of real pacman, correct output and exit status.",
|
|
"The five libs are deployed by install_files.sh and covered by the integrity manifest; tampering with one is detected and denied.",
|
|
"verify_shell_split.sh reports all functions moved verbatim.",
|
|
"The deployed /usr/local/bin/pacman_wrapper is byte-identical to the pre-work backup, and live pacman still works.",
|
|
"shellcheck passes without -x, shfmt is a no-op, no suppression added."
|
|
],
|
|
"out_of_scope": [
|
|
"Running a live `pacman -S` transaction: the Bash tool deadlocks on db.lck and a failure costs the package manager.",
|
|
"Re-deploying to /usr/local/bin — a separate, user-run step.",
|
|
"The pre-existing SC2329 suppression on load_policy_lists, which predates this split."
|
|
],
|
|
"verifier": "Real -Qi/-Q diffs against the captured baseline; a scratch-dir fail-open simulation with a lib removed; an integrity round-trip proving tamper detection covers the new libs; verify_shell_split.sh; sha256 of the deployed copy vs the pre-work backup; shellcheck + shfmt + check_file_length --all."
|
|
}
|