mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-15 01:50:55 +01:00
The periodic setup wrote /usr/local/bin scripts with sed > target, truncating the file in place. bash reads scripts lazily, so the running hosts-file-monitor could execute a half-new file. New lib/atomic_install.sh renders into a temp file beside the target, syntax-checks it, sets mode/owner and renames it over the target (new inode). A bad template fails closed and leaves the live file untouched. Applied to the maintenance script, hosts monitor, browser wrapper and auto-update script; the hosts monitor service is restarted if running. Test: test_services_atomic_install.sh (inode changes, old inode keeps old bytes, syntax error and missing template leave target untouched). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWYWDKuhbBAoNETfoB9
12 lines
662 B
JSON
12 lines
662 B
JSON
{
|
|
"title": "Atomic install of live periodic-setup scripts",
|
|
"objective": "Installing the periodic system scripts never truncates a file a service is running; the target gets a new inode and a bad template leaves the live file untouched.",
|
|
"acceptance_criteria": [
|
|
"Target inode changes and the old inode keeps its bytes",
|
|
"A template failing bash -n is not installed and leaves no temp file",
|
|
"hosts-file-monitor.service is restarted only if it was running"
|
|
],
|
|
"out_of_scope": ["Re-running the installer on the host", "Other installers"],
|
|
"verifier": "lib/tests/test_services_atomic_install.sh, lib/tests/run_all.sh, vmbox guest check"
|
|
}
|