fix(markdown-formatter): guard EPOCHREALTIME for Bash < 5 portability#17
Conversation
EPOCHREALTIME is Bash 5.0+; `start=$EPOCHREALTIME` under set -u aborts on Bash 3.2/4.x before the advisory exit 0, failing every edit. Default the stamp to empty and skip telemetry when it is unavailable, so the hook still formats on older bash. Mirrors the bash-lint fix; hook-utils.sh stays byte-identical. Bumps version to 0.1.1 so installed consumers receive the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WWt8nQzh8BAoZXRZRt2ARU
|
Claude finished @kyle-sexton's task in 1m 48s —— View job PR Review: fix(markdown-formatter): guard EPOCHREALTIME for Bash < 5 portability
SummaryThis is a correct, minimal, and well-scoped bug fix. The root cause was that Verdict: approve — no blockers.
|
| Concern | Status |
|---|---|
set -u abort on Bash < 5 fixed |
✓ |
No regression on Bash 5+ (empty guard is a no-op when EPOCHREALTIME is set) |
✓ |
All three hook::emit_telemetry call sites replaced |
✓ |
hook-utils.sh byte-identical to bash-lint copy |
✓ |
| Pattern matches bash-lint fix | ✓ |
| Version bump correct | ✓ |
| README updated | ✓ |
Summary
Propagation follow-up from #16's Codex review:
markdown-formattercarried the identical latent bug.EPOCHREALTIMEis Bash 5.0+. The hook'sstart=$EPOCHREALTIMEunderset -uaborts on Bash 3.2/4.x (e.g. stock macOS) before the advisoryexit 0— failing everyWrite/Edit, not just markdown ones (the capture runs before the file-type filter).Fix
start=${EPOCHREALTIME:-}(noset -uabort).emit_telwrapper skips telemetry when the stamp is empty, so the hook still formats on older bash; the high-res envelope is simply omitted there.hook-utils.shstays byte-identical to the bash-lint copy (the guard lives in the hook, not the lib).Verification (all green locally)
claude plugin validate --strictpassedmarkdown-format.test.sh41/0,hook-utils.test.sh37/0hook-utils.shbyte-identical toplugins/bash-lint/hooks/hook-utils.sh🤖 Generated with Claude Code