Skip to content

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

Open
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/reject-truncated-readonly-store
Open

Do not treat truncated read-only stores as empty files#59
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/reject-truncated-readonly-store

Conversation

@OskarEichler

Copy link
Copy Markdown

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.

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