Repository navigation
fix(runtime): backport printer position ownership - #2
Merged
Merged
Conversation
Backport upstream commit ef6f44f (oven-sh#42767), retaining the original runtime regression test. Derive the position from the current output buffer so reused printers do not accumulate a signed counter across modules.
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.
What does this PR do?
Backport oven-sh/bun#42767, commit
ef6f44f37d40e1405d94362d794fe95ace86faad, by Dylan Conway, preserving the original author and regression test.A reused runtime printer cleared its output buffer but retained a separate signed byte counter. After more than 2 GiB of cumulative output, that counter became negative and mandatory keyword spaces disappeared (
function named()becamefunctionnamed()). DeriveWriter::written()from the current buffer instead. This preserves the fork’s existing position semantics and removes the duplicated counter.The production and test patch matches upstream exactly; the fork changelog is the only additional change. Production: +2/-10 lines. Tests: +35/-1 lines.
How did you verify your code works?
1.4.3-canary.1+d33ade8b6, fails the upstream fixture: 2,100 reloads of a 1 MiB CommonJS module, followed by a named function, produceSyntaxError: Unexpected token '{'(exit 1).runtime-transpiler.test.tsanddir.test.ts.runtime-transpiler.test.ts,transpiler.test.jsanddir.test.ts. This includes the existing single-character keyword-spacing regressions.bun run rust:check-all: 12 targets passed, 0 failed, 0 skipped. This is compilation coverage, not a claim of execution on every platform.bec52588f6ab55cdc1bfc09e18897dd5272fcae9;git diff --checkpasses.Native proof ran on combined integration commit
9d7a8224f1616ec9ef8902ec83d11656b544036b, tree84541a6175c3bb796e79d5e91d72c69a96b7d0ac, which also includes the separate directory-entry backport. The printer source and regression-test blobs are identical to this PR. Linux x86_64; Clang/LLVM 21.1.8; Rust nightly-2026-07-20. Release artifact SHA-256:45a1a0327135f65080d9dc0f22221286b4e52c9cad3c50bf69adcaf9f8474951.