Skip to content

Fix #2 & #3: pr-to-file under -q on all backends; cap absvector size - #6

Merged
pyrex41 merged 1 commit into
kernel-41.2from
fix/cl-hush-and-absvector
Jun 14, 2026
Merged

Fix #2 & #3: pr-to-file under -q on all backends; cap absvector size#6
pyrex41 merged 1 commit into
kernel-41.2from
fix/cl-hush-and-absvector

Conversation

@pyrex41

@pyrex41 pyrex41 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Fixes #2. Fixes #3.

Two host-runtime fixes (canonical klambda/*.kl untouched), combined per cross-impl cluster.

#2 — CLISP/ECL silence pr to file under -q: the native pr override was guarded #+(or ccl sbcl), so CLISP and ECL fell back to the kernel's *hush*-gated pr and silenced all streams. Extended the override to ECL (#+(or ccl sbcl ecl), character streams) and added a #+clisp variant that dispatches on stream-element-type (CLISP opens files as unsigned-byte, so file streams take a write-byte loop). All backends now write to non-stdout streams regardless of *hush*, matching SBCL.

#3(absvector <huge>) uncatchable heap exhaustion: added a 2^24-slot cap (~800× the largest vector the kernel itself allocates); an out-of-range size now raises a catchable simple-error instead of an SBCL heap-exhaustion abort. (trap-error (absvector 100000000000) (lambda E E)) now returns the error; legitimate and boundary sizes still succeed.

Verification: kernel certification SBCL 134/134, CLISP 134/134; port regression suite 126/126 on SBCL. Both repros pass on sbcl/clisp/ecl.

🤖 Generated with Claude Code

Issue #2 (-q/*hush* silences pr to file streams on CLISP and ECL):
The native |pr| override was guarded #+(or ccl sbcl), so CLISP and ECL
fell back to the kernel's portable *hush*-gated KL pr, which returns
early without writing whenever *hush* is true -- wrongly silencing pr to
FILE streams under -q and producing zero-byte files. Extend the native
override to ECL (its file streams are character streams, so the existing
write-string path applies) and add a CLISP variant that dispatches on
stream-element-type (CLISP opens files as 'unsigned-byte per shen.openh,
so it uses a write-byte path). All backends now write to a non-stdout
stream regardless of *hush*, matching SBCL/CCL.

Issue #3 ((absvector <huge>) -> uncatchable SBCL heap exhaustion):
make-array with an oversized count triggers an uncatchable
HEAP-EXHAUSTED-ERROR abort that trap-error cannot recover from, taking
down the image. Add a sanity cap (2^24 slots, ~800x the largest vector
the kernel ever allocates) so an excessive request raises a catchable
Shen simple-error instead of crashing. Matches shen-go's intent.

Verified before/after on SBCL, CLISP and ECL (all binaries installed):
- pr -q to a file now writes 'payload' on all three backends.
- (trap-error (absvector 100000000000) (lambda E E)) returns the error
  object instead of aborting.
Canonical kernel suite 134/134 on SBCL and CLISP; port suite 126/126 on
SBCL. Kernel (klambda/*.kl) untouched; fix lives in the runtime layer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant