You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
example-apps: review of the audit fixes — one was a regression, one was half a fix
Re-checking the audit commits by ATTACK and MUTATION rather than by "the gate
is green" found two defects in the fixes themselves. Both are corrected here.
1. The watchdog change was a REGRESSION. Replacing `kill -9 $$` with
`kill -TERM $$` plus a TERM trap does nothing in the case a watchdog exists
for: bash DEFERS a trapped signal until the running foreground command
returns, and in a real hang that is never. Measured on a copy of a real
smoke script — watchdog fired at t=2 s, the trap ran at t=30 s, only once
the blocking command ended by itself. So the previous version at least
killed the script; mine killed nothing.
Cleanup is now the WATCHDOG's job, since the script provably cannot do it:
it kills the script's other children (`pgrep -P $$`, skipping itself), runs
`cleanup`, and only then SIGKILLs the script. Verified end to end against an
injected foreground hang: timed out on schedule, no orphaned processes, temp
dir removed. (`kill -9 -$$` remains out: a smoke shares check-apps.sh's
process group and would take the gate with it.)
2. The timecapsule overflow fix only MOVED the panic. Saturating `publishTime`
left `formatUtc` casting a saturated timestamp's year into a u32, so a
capsule claiming round 2^63 still aborted `info` with SIGABRT. The lesson is
the general one: a clamp is not a fix until every consumer of the clamped
value is total too. `formatUtc` now refuses to render outside the printable
calendar. Verified by attack (rounds 0, 2^63, 2^64-1 → exit 1/3, never 134)
and pinned by a new smoke case that is mutation-checked: with the guard
removed the smoke fails with exactly that panic.
Also, smaller, from the same pass:
- getTask wrote its 404 through `jsonError` while holding the lock — the very
pattern the audit fixed elsewhere, and inconsistent with every sibling
handler, all of which unlock first. Now it unlocks first too.
- raft-kv's smoke cleanup named `n*/raft.kv` and `*.log`, so `raft.kv.lock`
and `status.out` kept a temp directory alive after every run (two per gate
pass). It now clears the directory it made.
- ssh-demo's new exclusive create turned a stale temp file into a permanent
failure once a pid was reused; it unlinks first, which does not weaken the
symlink guard (unlink removes the link, and a re-planted one still fails
`exclusive`).
- timecapsule's README records that keygen refuses to overwrite a keypair.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments