-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Inherit Linux semantics for fd_pwrite
with O_APPEND
#8823
Inherit Linux semantics for fd_pwrite
with O_APPEND
#8823
Conversation
Redirecting to @pchickey |
31abbbd
to
60e99ee
Compare
This commit updates the implementation of `fd_pwrite` in WASI to match Linux semantics for an under-specified corner of WASI. Specifically if `fd_pwrite` is used the offset specified is ignored if the file is opened in append mode and the bytes are instead appended. This commit additionally refactors `fd_write` and `fd_pwrite` to have basically the same code with only a minor branch internally when the final write is being performed to help deduplicate more logic. Closes bytecodealliance#8817
prtest:full
60e99ee
to
969b222
Compare
CI turned up an interesting phenomena which makes sense in retrospect. With wasi-common the behavior is subject to whatever the platform OS provides which makes Linux the odd-one-out. Papering over OS differences is easy enough in @pchickey how do you feel about sticking with these semantics and just ignoring the whole test in wasi-common? Alternatives could include not landing this in Wasmtime and taking it up in an issue with WASI and/or adding more stuff to wasi-common. |
I think it is fine to just leave this bug in wasi-common and ignore the test - I don't think there is much value in bringing bug fixes for corner cases like this, if users need the fix the real question is why they havent upgraded to wasmtime-wasi. |
This commit updates the implementation of
fd_pwrite
in WASI to match Linux semantics for an under-specified corner of WASI. Specifically iffd_pwrite
is used the offset specified is ignored if the file is opened in append mode and the bytes are instead appended.This commit additionally refactors
fd_write
andfd_pwrite
to have basically the same code with only a minor branch internally when the final write is being performed to help deduplicate more logic.Closes #8817