Fix: pr to a file stream must ignore *hush* on ECL and CLISP - #4
Conversation
The kernel's KL pr (writer.kl) returns early without writing whenever *hush* is true, which wrongly silenced (pr STR FileStream) under -q -- producing a zero-byte file. SBCL/CCL already bypassed the KL pr with a native write-string override; the ECL and CLISP builds ran the KL pr and so dropped the write under -q. Fix: extend the native pr override so all four impls write to the target stream regardless of *hush*. ECL joins the existing write-string override (its file streams are character streams). CLISP, whose file streams are opened with :element-type 'unsigned-byte, gets a sibling override that dispatches byte streams to write-byte (matching the kernel KL pr's own stream dispatch) while still writing character streams via write-string -- in both cases without consulting *hush*. Tests: scripts/test-cli.sh now asserts the SAME corrected -q pr-to-file behaviour for every impl (was per-impl, recording clisp/ecl as silencing). tests/io-tests.shen gains a regression "pr to a file stream ignores *hush* (issue #2)" and updates the locked-in comment. Canonical SBCL cert 134/134 100%, compiler tests pass, port suite 127/127, CLI parity 47/47 across sbcl+clisp+ecl. Fixes #2 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Independent agent review (ratatoskr + ShenSpec deep-dive, post-load native override discipline, 134/134 cert preserved) Code Review: #4"Fix: pr to a file stream must ignore hush on ECL and CLISP"PR URL: #4 Key context applied:
All four hush issues share the same upstream writer.kl gate. Strategy (native |pr| override after kernel load in boot.lsp:171 and driver.lsp:139) is consistent with prior partial fix for sbcl/ccl. Port suites + certs stayed green per PR metadata. Summary of Changes (Correctness First)src/overwrite.lsp (core fix):
scripts/test-cli.sh + tests/io-tests.shen (spec + regression):
Why this is the right fix (architecture): shen-cl is ratatoskr's reference host. The override lives in the port's post-kernel Verification performed (per instructions): hush never consulted (confirmed in both new |pr| bodies and comments); clisp dispatch uses subtypep + write-byte loop on non-char and never write-string on bytes; force-output gated exactly as required (only st in char case); right-hand diff lines cited below; io-tests + test-cli are treated as the executable cross-impl spec and now assert the unified contract. Overall correctness: The change is correct for the stated problem (pr to file streams under hush). It also unifies console pr behavior across the three impls (previously clisp/ecl would hush pr to their st under -q; now they match sbcl's pre-existing "always write" override). Tests, load order, and ratatoskr integration were considered. No races, no locks, no unwrap-style (handler-case) misuse. IssuesSeverity: MINOR Severity: MINOR Severity: NIT / STYLE Severity: NIT Severity: NONE (POSITIVE) Severity: NONE (VERIFICATION)
Severity: NONE (ARCHITECTURE) No CRITICAL or MAJOR issues. No error-handling gaps that would affect the shen-visible contract, no races (Shen/Lisp runtime here is single-threaded for these paths), no inappropriate lock usage, and no unwrap-style bare Final VerdictThe fix is correct, minimal, and complete. It directly addresses the root cause (writer.kl hush gate applying to file streams), correctly extends the established native-override pattern used by the reference SBCL build, handles the clisp byte/char reality without violating the "never write-string on byte streams" rule, confines force-output exactly as specified, never consults hush, and updates the executable ShenSpec (cli parity matrix + io-tests) to assert the unified desired behaviour rather than codifying the old divergence. All review requirements (deep dives into ratatoskr writer + builder, primitives openh + st* setup, char-stoutput? dispatch relation, right-side line citations, structured issues, no self-fixing) were followed. Review file: Concise verdict: APPROVE — ready to merge. One minor edge-case behaviour note for raw (non-shen) byte streams on ECL (pre-existing pattern on SBCL/CCL) and a few style nits; no correctness, test, or integration problems. The port now has uniform pr-to-file semantics under hush across sbcl/clisp/ecl. Posted automatically by Grok reviewer subagents. See also the PENDING review (if any) for inline comments on the Files tab. |
|
From independent reviewer subagent (ratatoskr as reference host, writer.kl gate, overwrite load order in boot.lsp + lisp builder, char-stoutput? / openh element-type reality, and executable spec in test-cli.sh + io-tests.shen): MINOR
NIT / STYLE
NIT
Positive: clisp dispatch correct (subtypep + write-byte on non-char, never write-string on bytes), hush never consulted, force-output confined exactly to st in char case, load order respected, test-cli now asserts unified behavior across all three impls (excellent comment updates). Full ratatoskr + builder analysis in previous top-level comment on this PR. APPROVE (ready to merge) per subagent. |
Summary
Under
-q(which sets*hush*true),(pr STR FileStream)was silenced on the ECL and CLISP builds, producing a zero-byte file, while SBCL wrote it. The kernel's KLpr(writer.kl) returns early without writing whenever*hush*is true:SBCL/CCL already bypassed this with a native
write-stringoverride (src/overwrite.lsp), so theirprignores*hush*. ECL and CLISP ran the KLprand so dropped the write under-q.Fix
src/overwrite.lsp:proverride to ECL (its file streams are character streams, so the samewrite-stringpath applies).:element-type 'unsigned-byte(see|shen.openh|insrc/primitives.lsp), sowrite-stringis illegal on them; the kernel KLprdispatches such streams to awrite-bytepath. The override mirrors that dispatch (byte streams →write-byte, character streams →write-string) but, like the SBCL/CCL/ECL override, never consults*hush*.All four impls now agree:
prwrites to its target stream regardless of*hush*.Test changes
scripts/test-cli.sh: the-qpr-to-file check now asserts the same corrected behaviour for every impl (previously it recorded clisp/ecl as silencing).tests/io-tests.shen: adds regression"pr to a file stream ignores *hush* (issue #2)"and updates the locked-in divergence comment.Results
Rebuilt sbcl + clisp + ecl images.
make test-sbcl): 134/134, 100%make test-compiler): passmake test-port): 127/127make test-cli, sbcl+clisp+ecl): 47/47, 0 failed — all three impls now WRITE the-qfileFixes #2
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com