Skip to content

fix(io): fail file writes on zero progress - #1446

Merged
Lorenzobattistela merged 1 commit into
bendlang:mainfrom
oxura:fix/file-write-progress
Oct 14, 2026
Merged

Lorenzobattistela merged 1 commit into
bendlang:mainfrom
oxura:fix/file-write-progress

Conversation

@oxura

@oxura oxura commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1445.

File.write and File.write_bytes loop until every byte is written, moving on by the count the host returns. If the host returns 0 with bytes left, the loop never ends. Both the C loop (effs/file_write.c) and the JS loop (effs/file_write.js) now fail with EIO (5) when that happens. The handle still comes back outside the Result. Empty writes, short writes that make progress and existing errors (ENOSPC, EFBIG, ...) behave as before.

Test: tests/io/file_write_zero.bend opens /dev/null through a test effect whose nonempty writes all return 0, and checks that File.write and File.write_bytes give 5 and that an empty write still succeeds. On main it hangs in C, bun and the interpreter.

Gates on main d0cb504: repo 54/54, test 1625/1625.

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.

File writes do not terminate on zero progress

2 participants