Repository navigation
Merged
Conversation
…ession.sh (#642, #643) #642: NOW_DAY_FILE was read via a bare `cat "$NOW_DAY_FILE" 2>/dev/null | tr -d "[:space:]"`, unlike its siblings ndc_read_gen() (#634) and ts_marker_read() (#625) -- no regular-file type check. A FIFO placed at that path hangs the read forever (no writer, no O_NONBLOCK); a character device streams unboundedly. Guarded the read with `[ -f "$NOW_DAY_FILE" ]`, falling through to the same TODAY_DATE fallback an absent or garbage-content file already takes. #643: five more `> FILE 2>/dev/null`-shaped writes leak bash's own raw diagnostic when the `>` itself fails, the same defect #635 fixed at two sites -- redirections process left to right, so a failing `>` is reported to the real stderr before `2>/dev/null` ever takes effect. Found by grepping the exact shape (a `>` followed directly by `2>/dev/null` on the target's own quoted variable), which returns exactly these five, plus the two #635 already fixed (excluded since their `{ ...; }` wrap no longer matches the bare shape): - COOLDOWN_MARKER's self-heal write (the ELAPSED<0 branch -- distinct from the guarded write #635 fixed a few lines below it) - NDC_MARKER's self-heal write (same shape) - NOW_DAY_FILE's fresh-stamp write (now.md starting empty) - NOW_DAY_FILE's restamp write (after an NDC compression keeps bytes) - the NDC_TAIL truncate-and-copy `tail` write (an `if ... ; then` rather than `||`, same ordering defect) All five wrapped in the same `{ ...; }` grouping #635 introduced. Tests: tests/test_now_day_file_fifo_642.py extracts the NDC_DAY read block by content and proves the FIFO case no longer hangs (5s timeout as the assertion), with positive controls for the absent and regular-file cases. tests/test_stderr_leak_sites_643.py extracts each of the five statements and runs it against a directory standing in for the target (the same "Is a directory" technique tests/test_marker_write_stderr_order_635.py uses) -- one negative case per site (no raw diagnostic leaks) paired with one positive case (the write still succeeds against a normal target). Both files reproduce red against the pre-fix script and green after. Changelog fragments for both issues; docs/windows-skip-triage.md rows for the two new blanket win32-skip test modules. Claude-Session: https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Self-review (oss:auditor) flagged tests/test_stderr_leak_sites_643.py's row landing between the test_ndc_* entries instead of alphabetically among the test_st* entries. Cosmetic only -- the table is keyed by exact filename text, not position -- but fixed while the context is loaded. Claude-Session: https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two issues found by PR #641's own self-review while fixing #634, both in
scripts/save-session.sh.#642 --
NOW_DAY_FILEwas read via a barecat "$NOW_DAY_FILE" 2>/dev/null | tr -d '[:space:]', unlike its siblingsndc_read_gen()(#634) andts_marker_read()(#625), neither of which has a regular-file type check. A FIFO placed at that path hangs the whole save indefinitely (no writer, no O_NONBLOCK, no timeout anywhere in this script); a character device streams unboundedly. Fixed by guarding the read with[ -f "$NOW_DAY_FILE" ], falling through to the existingTODAY_DATEfallback that an absent or garbage-content file already took.#643 -- five more
CMD > FILE 2>/dev/null-shaped writes leak bash's own raw diagnostic when the>redirection itself fails, the same defect #635 already fixed at two other sites. Redirections process left to right, so a failing>is reported to the real stderr before2>/dev/nullever takes effect. Grepped for the exact shape (a>followed directly by2>/dev/nullon the target's own quoted variable) and it returns exactly five lines beyond the two #635 already fixed:COOLDOWN_MARKER's self-heal write (theELAPSED<0branch -- distinct from the guarded write Guarded marker writes' stderr suppression fires after the write, not before -- "2>/dev/null" on "date +%s > MARKER || ..." leaves the shell's own permission-denied line unsuppressed #635 fixed a few lines below it, reached via a different branch of the sameif)NDC_MARKER's self-heal write (same shape)NOW_DAY_FILE's fresh-stamp write (now.md starting empty)NOW_DAY_FILE's restamp write (after an NDC compression that keeps bytes)NDC_TAILtruncate-and-copytailwrite (anif ... ; then ... else ...rather than||, same ordering defect)All five wrapped in the same
{ CMD > FILE; } 2>/dev/nullgrouping #635 introduced.Below-bar finding, not filed as an issue
Self-review (oss:auditor) flagged
docs/windows-skip-triage.md's new row fortests/test_stderr_leak_sites_643.pylanding out of alphabetical order in the table. Cosmetic only -- the table is keyed by exact filename text, not position -- so this is a below-bar finding rather than one worth a tracker issue. Fixed anyway in the follow-up commit, since the context was already loaded.Test plan
tests/test_now_day_file_fifo_642.py-- extracts theNDC_DAYread block by content out ofscripts/save-session.shand runs it in isolation: a FIFO no longer hangs (5s timeout as the assertion), with positive controls for the absent-file and regular-file cases. Red against the pre-fix script (TimeoutExpired), green after.tests/test_stderr_leak_sites_643.py-- extracts each of the five statements and runs it against a directory standing in for the target file (the same "Is a directory" techniquetests/test_marker_write_stderr_order_635.pyuses): one negative case per site (no raw diagnostic leaks) paired with one positive case (the write still succeeds against a normal target). Red against the pre-fix script (8/13 failing), green after (13/13).tests/test_marker_range_guard_326.py,tests/test_ndc_day_boundary.py,tests/test_marker_write_stderr_order_635.py,tests/test_ndc_truncate_race.py,tests/test_ndc_tail_failure_no_truncate.py,tests/test_ndc_commit_atomicity.py,tests/test_ndc_commit_lock.py,tests/test_windows_skip_triage_497.py,tests/test_windows_skip_triage_no_stale_prose_counts_613.py-- all pass.bash -n scripts/save-session.shandshellcheck scripts/save-session.sh-- no new findings near the changed lines.python3 .oss/assemble_changelog.py --check-- 7 fragments, both new ones (642.fixed.md,643.fixed.md) parse clean.pytestsuite -- not run locally; CI is the merge gate for the whole matrix (13 legs, 3 OSes, 4 interpreters).Closes #642, closes #643.
🤖 Generated with Claude Code
[AI-generated]