linux-boot: harden boot-digest/run-boot dedup, empty-stats, and argument checks #2274
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2274
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/linux-boot-scripts-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: LINUX-BOOT-SCRIPTS-EXACT-DEDUP-EMPTY-STATS-AND-ARG-GUARDS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191439979)
What and why
scripts/linux-boot/boot-digest.shandscripts/linux-boot/run-boot.shpreviously:/opt/leonidainstead of defaulting viaLEONIDA_BOOT_ROOT, lacked directory creation before digest/ledger writes inboot-digest.sh, and ranflockwithout checking availability.grep -q -P "^[^\t]*\t$AGENT\t$N\t"for ledger deduplication, allowing regex metacharacters in agent names (e.g.a.bmatchingaxb).[ -f "$CAP/index.txt" ](emitting broken counts for 0-byteindex.txt) and ignored sample row counts inawkoverresources.tsv(printing empty MB stats and0peak MB on header-only files), while leavingsedstderr unguarded whenboot-<n>.metawas missing.AGENT,N,SECS(<= 0or non-numeric), and malformedKEY=VALUEenvironment overrides without upfront validation.This adds
LEONIDA_BOOT_ROOTsupport, upfront argument validation, literalawkledger deduplication,[ -s "$CAP/index.txt" ]andawksample-count checks,flock/.metaguards, LF preservation, and stdlib bash regression tests intests/test_linux_boot_scripts.py.Tested
python -I tests/test_linux_boot_scripts.py -v(3 passed)upstream/mainbaseline negative control: failed withtests/test_linux_boot_scripts.pybefore the fixpython -I tests/test_ci_registration.py,python -I tests/test_text_write_line_endings.py,python -I scripts/check_no_game_data.py,python -I -m compileall -q, andgit diff --cached --checkGPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU, no Wine). Merges cleanly. With this PR, python -I tests/test_linux_boot_scripts.py: 3 tests OK. The PR's test file against main's scripts: 1 failure, so the new test fails on main and passes with the change. compileall clean.
AI-assisted: yes (Claude Code)
Red/green: tests/test_linux_boot_scripts.py fails 1 assertion on main (boot-digest.sh/run-boot.sh dedup, empty stats and argument guards) and passes with the PR (cloud run on main 7daa4a4).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)