Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSWriteStream>>nextPut: does not truncate a file in memory #14

Open
MariusDoe opened this issue Oct 1, 2024 · 0 comments
Open

FSWriteStream>>nextPut: does not truncate a file in memory #14

MariusDoe opened this issue Oct 1, 2024 · 0 comments

Comments

@MariusDoe
Copy link

When using an FSMemoryStore, after closing a write stream that only called nextPut:, the file is not properly truncated. nextPutAll: does not have this behavior.

| fs ref |
fs := FileSystem memory.
ref := fs / 'test'.
ref writeStreamDo: [:s | s nextPutAll: 'abc'].
ref contents. "'abc'"
ref writeStreamDo: [:s | s nextPutAll: 'xy'].
ref contents. "'xy'"
ref writeStreamDo: [:s | s nextPut: $!].
ref contents. "'!y'"

Some investigation:

I'm not sure whether basicNextPut: is at fault for calling at:put: instead of at:write:startingAt:count: or whether at:put: should instead set the size to the index - maybe at:put: is sometimes used to set bytes in the middle of a file, without wanting a truncation?

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

No branches or pull requests

1 participant