Skip to content

At least five more 2>/dev/null-after-a-failing-> sites in save-session.sh leak bash's raw diagnostic into hook-errors.log, unfixed by #635 #643

Closed

Description

@fdaviddpt

Found by PR #641's self-review (Explore + oss:auditor) while fixing #635, which corrected the redirection order at two guarded marker writes (COOLDOWN_MARKER, NDC_MARKER).

Symptom

The same class #635 fixed -- 2>/dev/null placed after a failing > redirect, so bash's own raw diagnostic line reaches hook-errors.log unsuppressed, either alone or duplicating an intended report_error() line -- exists at further sites in the same file that #635's brief did not name and this fix did not touch.

Location

scripts/save-session.sh (pre-diff line numbers): :397 (COOLDOWN clock-skew self-heal), :879 and :1303 (NOW_DAY_FILE writes), :1001 (NDC clock-skew self-heal -- deliberately left alone by PR #641 since it was outside #635's stated scope), and a structurally different but mechanistically identical if ... > file 2>/dev/null; then shape at :1254.

Mechanism

Bash processes redirections left to right: > is attempted -- and fails -- before 2>/dev/null takes effect, so the suppression is a no-op for the redirection it appears to guard. Same mechanism #635 fixed at its two sites, unfixed at these.

What would settle it

Each site needs the same { redirect; } 2>/dev/null || ... grouping fix #635 applied, or the 2>/dev/null dropped where hook-errors.log already catches the raw line (mitigated today by bootstrap-dirs.sh:336's exec 2>> hook-errors.log, same mitigation #635's own issue named). Not independently reproduced per-site here; #635's own reproduction (against a chmod 500 directory) already demonstrates the mechanism generalizes to any > failure at any of these sites.

Severity: same as #635 -- non-blocking, a duplicated/leaked diagnostic line in a file bug reporters are asked to paste, not a stream leak (mitigated by the same exec 2>> redirect). Row: misreports.

[AI-generated, filed by the maintainer loop from PR #641's own self-review]

[AI-generated]

Activity

  1. added
    priority:low
    filed-by-loop
    lane-consolidation
    on Sep 10, 2026
  2. self-assigned this
    on Sep 10, 2026
  3. removed their assignment
    on Sep 10, 2026
  4. added 2 commits that reference this issue on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    filed-by-looplane-consolidationpriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions