Repository navigation
claw-ctx v6.13.2
claw-ctx v6.13.2 — GNU-Portable mtime_of in Pre-Push + Audit Gate
Scope: gate/hook portability fix only. No product behavior change —
src/untouched, zero new dependencies,ctx_compact/ctx_build/
ctx_injectsignatures unchanged.
Fixed
mtime_of is now GNU-portable
Both .githooks/pre-push and tools/audit-stage-gate.sh derived a file's
mtime with a BSD-first fallback:
m=$(stat -f %m "$f") || m=$(stat -c %Y "$f")Under GNU stat the first form never fails: stat -f %m exits 0 and
prints a non-numeric value (?). The || fallback therefore never fired, and
the garbage value flowed straight into the batch window's integer comparisons
(-ge / -lt), producing integer expression expected and a fail-closed
reject on ubuntu. The same bug class was fixed in devclaw v10.3.2 (52363ad1).
The lookup is now GNU-first (stat -c %Y first) with a numeric guard:
case "$m" in ''|*[!0-9]*) m=0 ;; esac- Value side only — the window assertions themselves are unchanged.
- Garbage still maps to
0(i.e. "older than the batch window") → fail-closed,
so a broken stat can never fabricate a passing window. - POSIX
sh, zero new dependencies.
Tests
- The two gate suites: 61 passed — a faithful GNU shim (real mtime → window
math intact) and a numeric-guard probe (garbage →0, no shell error).
Reverting the fix turns 4 of the new cases red and reproduces
integer expression expected; restoring it returns to 61 passed. - Full suite 114 files / 1409 passed, 0 failed, 5 skipped;
tsc --noEmit
clean; zero new dependencies.
Full Changelog: https://github.com/opensourceclaw/claw-ctx/blob/main/CHANGELOG.md