Skip to content

Bun.write: deliver the whole payload to a FIFO instead of a torn prefix - #36025

Open
robobun wants to merge 4 commits into
mainfrom
farm/823b0b16/bun-write-fifo-torn
Open

Bun.write: deliver the whole payload to a FIFO instead of a torn prefix#36025
robobun wants to merge 4 commits into
mainfrom
farm/823b0b16/bun-write-fifo-torn

Bun.write: deliver the whole payload to a FIFO instead of a torn prefix

3cac646
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 26, 2026 in 27m 48s

Code review found 1 important issue

Found 3 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/webcore/Blob.rs:5465-5473 Bun.write(fifo, "") regresses from resolved(0) to rejected(EINVAL)
🟡 Nit src/runtime/webcore/Blob.rs:5532-5533 _needs_async underscore prefix now misleading

Annotations

Check failure on line 5473 in src/runtime/webcore/Blob.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Bun.write(fifo, "") regresses from resolved(0) to rejected(EINVAL)

This handoff fires before the empty-payload check, so `Bun.write(fifo_path, "")` — which previously resolved with `0` (open, skip write loop, discard the `ftruncate` EINVAL, close) — now routes to the async path, where an empty source has `store=None` and falls into `write_file_with_empty_source_to_destination` → `libc::truncate(fifo_path, 0)`, which returns `EINVAL` on Linux for any non-regular file and rejects the promise. Gate the handoff on `!str.is_empty()` here (and `!bytes.is_empty()` at 

Check warning on line 5533 in src/runtime/webcore/Blob.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

_needs_async underscore prefix now misleading

nit: `_needs_async` — the leading underscore signals "intentionally unused" in Rust, but this parameter is written on three paths (and this PR adds one of them). The sibling `write_string_to_file_fast` already names it `needs_async`; since you're touching this signature anyway to add `handoff_fd`, worth dropping the underscore to match.