Skip to content

log.sh control-byte flattening (#599) does not cover the four hook-errors.log writers #618

Closed

Description

@fdaviddpt

Filed by the release-3 audit for v0.29.0..HEAD (round 1, dispatch token gate3-682bbe1d0550).

#599 added control-byte flattening inside log() at scripts/log.sh:528, and both the code comment and changelog.d/599.fixed.md:12-14 claim the class is closed everywhere log() is used. It is closed for the daily log, but four reporters write the same message string a second time, raw, to hook-errors.log: _dispatch_report_failure (log.sh:805), _dispatch_report_skip (:824), report_error (:842), _dispatch_report_timeout (:873). That file is the one /remember:doctor tails under "Recent errors" (scripts/doctor.sh:826-831) and is what maintainers ask a reporter to paste (CHANGELOG:1381). For the timeout/failure paths the embedded $_said/$_why is a third-party hook's own stderr.

Control run (in-memory, no writes):

printf 'a\rFORGED\vB\fC\n' | while IFS= read -r l; do printf 'LINE=[%s]\n' "$l"; done | cat -v
  -> LINE=[a^MFORGED^KB^LC]
printf 'a\rFORGED\vB\fC' | LC_ALL=C tr '[:cntrl:]' ' '
  -> a FORGED B C

CR/VT/FF survive bash read -r (used by _dispatch_stderr_excerpt:726 and doctor.sh:829) while the same string reaching the daily log has them replaced with spaces.

Not ranked forges: the LF route is already closed (_dispatch_stderr_excerpt:732 folds lines with " | ", so a newline cannot reach the sink), and no current consumer of hook-errors.log splits records on CR/VT/FF/0x85 (checked: the only two splitlines() calls in the tree, pipeline/consolidate.py:216 and pipeline/spawn_guard.py:152, do not read this file). If a consumer that splits on those bytes is ever added, this becomes forges and blocks a release.

Fix: move the flatten into the shared sink so all writers to hook-errors.log get it, or apply the same tr '[:cntrl:]' at each of the four call sites, and correct the #599 changelog/comment claim of full coverage.

Row: misreports (can ship behind a filed issue, not blocking).

[AI-generated]

Activity

  1. added
    priority:medium
    filed-by-loop
    lane-capture
    cohort-8
    on Sep 7, 2026
  2. self-assigned this
    on Sep 7, 2026
  3. added 2 commits that reference this issue on Sep 7, 2026
  4. added 3 commits that reference this issue on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-8filed-by-looplane-capturepriority:medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions