-
Notifications
You must be signed in to change notification settings - Fork 824
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
Cannot open a file with O_TRUNC and O_APPEND #4376
Comments
@yagehu thanks for reporting this, it will be fixed in an upcoming release. |
The combination of But if it is desired to allow this combination, we have to bypass |
Or, maybe we could detect the combination and keep only one of the two flags? I assume specifying both flags is undefined behavior in Linux? |
When you combine |
Well, yes, that's why rust gives you the error, but we're aiming for compatibility with the behavior of native binaries, be it as wrong or nonsensical as it may, so let's replicate the native behavior here. |
@maminrayej keep in mind, Wasmer runs on Windows as well, so make sure any changes you make are also compatible with Windows. |
Describe the bug
This might be a wontfix but I figure I should report this anyway since out of all the runtimes I've tested only Wasmer and wasmi have this behavior. Native Linux also does not have this behavior.
Opening a file with O_TRUNC and O_APPEND together results in errno 28
inval
. This is a result of the host-fsFileSystem
uses Ruststd::fs::OpenOptions
, which performs this check.I think Wasmtime doesn't have this behavior because it uses rustix which directly invokes the
open
syscall without this extra check.$ zwasmer -vV; rustc -vV wasmer 4.2.4 (0d782f1 2023-12-22) binary: wasmer-cli commit-hash: 0d782f18f99ba503f9aff89669c6ffd8e1631f53 commit-date: 2023-12-22 host: x86_64-unknown-linux-gnu compiler: singlepass,cranelift rustc 1.74.1 (a28077b28 2023-12-04) binary: rustc commit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1 commit-date: 2023-12-04 host: x86_64-unknown-linux-gnu release: 1.74.1 LLVM version: 17.0.4
Steps to reproduce
Compile the snippet with wasi-sdk and run with wasmer, mounting a directory.
Expected behavior
It should create the file
tmp/j
and exit with no error.Actual behavior
The text was updated successfully, but these errors were encountered: