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

preview1: Update semantics of seeking on appending files #7586

Conversation

alexcrichton
Copy link
Member

This commit updates the semantics of fd_{seek,tell} on preview1 to match native Unix when used with appending files. On Unix write claims to always update the file position pointer to the end of the file, so this commit implements that instead of the previous logic of ignoring the position update for appending files. This currently requires an extra roundtrip via stat to figure out the size of the file, but for now that seems to be the best that can be done.

Closes #7583

This commit updates the semantics of `fd_{seek,tell}` on preview1 to
match native Unix when used with appending files. On Unix `write` claims
to always update the file position pointer to the end of the file, so
this commit implements that instead of the previous logic of ignoring
the position update for appending files. This currently requires an
extra roundtrip via `stat` to figure out the size of the file, but for
now that seems to be the best that can be done.

Closes bytecodealliance#7583
@alexcrichton alexcrichton requested a review from a team as a code owner November 27, 2023 16:52
@alexcrichton
Copy link
Member Author

For the Unix behavior I'm reading this site, specifically the "NOTES" section

Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pchickey pchickey added this pull request to the merge queue Nov 27, 2023
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Nov 27, 2023
Merged via the queue into bytecodealliance:main with commit 55ac268 Nov 27, 2023
18 checks passed
@alexcrichton alexcrichton deleted the update-preview1-seek-on-appending-files branch November 27, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fd_tell not working when file is opened with fdflags::append
2 participants