Skip to content

Do not treat truncated read-only stores as empty files - #59

Merged
nobu merged 3 commits into
ruby:masterfrom
OskarEichler:codex/reject-truncated-readonly-store
Sep 5, 2026
Merged

Do not treat truncated read-only stores as empty files#59
nobu merged 3 commits into
ruby:masterfrom
OskarEichler:codex/reject-truncated-readonly-store

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Only treat EOFError as a new empty store when the file is actually empty. A truncated Marshal stream currently appears to be an empty store in read-only transactions.

Reproduction and verification

Checked every nonempty prefix of a small Marshal store, plus a truly empty file. Truncated prefixes must be rejected; an empty file must remain a valid empty store.

  • External focused corpus: 33 verified on this isolated branch under rbenv Ruby 4.0.6.
  • Existing upstream RBENV_VERSION=4.0.6 rbenv exec rake test: 13 tests / 26 assertions, zero failures before and after.
  • All files and injected failures are confined to scratch storage; no production operations.
  • No repository tests added or modified under the contributor's task constraint. Other Ruby versions and native Windows were not executed locally.

Breaking-change notes and limitations

Read-only callers now receive the underlying EOFError for truncated nonempty data instead of silently receiving an empty store. Genuine empty/missing read-only stores retain their behavior.

@nobu
nobu merged commit b93b80d into ruby:master Sep 5, 2026
33 checks passed
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.

2 participants