-
Notifications
You must be signed in to change notification settings - Fork 757
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
path_open
not working with wasi-sdk
#4361
Labels
❓ question
I've a question!
Comments
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` causes the WASI runner to map it to the virtual root, causing `path_open` to fail. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` causes the WASI runner to map it to the virtual root, causing `path_open` to fail. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` causes the WASI runner to map it to the virtual root, causing `path_open` to fail. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` causes the WASI runner to map it to the virtual root, causing `path_open` to fail. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` causes the WASI runner to map it to the virtual root, causing `path_open` to fail. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` causes the WASI runner to map it to the virtual root, causing `path_open` to fail. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 18, 2023
This commit fixes the bug where preopening `.` is not reflected in the virtual filesystem, causing `path_open` to fail to find files. fixes wasmerio#4361
The file system is sandboxed by default. You need to mount host directories into the WASM context by using In your example: |
Feel free to comment/reopen if you run into additional issues. |
I believe this is just an error with mapping |
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 22, 2023
This commit fixes a bug where creating a file with an implicit relative path returns `0` indicating success, but no file is created on the host. Here, implicit relative means a relative path that does not begin with `./`. For example, calling `open("somefile", O_CREAT | O_WRONLY)` will try to create a file called `somefile` in the current working directory. The fix is to change the current directory if the user has explicitly mounted any host directory to `.` in guest. In this case, the user's intention is clear: the current directory *is* the mounted host directory. fixes wasmerio#4361
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Dec 22, 2023
This commit fixes a bug where creating a file with an implicit relative path returns `0` indicating success, but no file is created on the host. Here, implicit relative means a relative path that does not begin with `./`. For example, calling `open("somefile", O_CREAT | O_WRONLY)` will try to create a file called `somefile` in the current working directory. The fix is to change the current directory if the user has explicitly mounted any host directory to `.` in guest. In this case, the user's intention is clear: the current directory *is* the mounted host directory. fixes wasmerio#4361
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
This following simple C program compiled with wasi-sdk does not work with Wasmer.
$ wasmer -vV; rustc -vV wasmer 4.2.4 (1abcd2c 2023-12-16) binary: wasmer-cli commit-hash: 1abcd2cc63deeca13af6506add6029edaba4d657 commit-date: 2023-12-16 host: x86_64-unknown-linux-gnu compiler: singlepass,cranelift rustc 1.73.0 (cc66ad468 2023-10-03) binary: rustc commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33 commit-date: 2023-10-03 host: x86_64-unknown-linux-gnu release: 1.73.0 LLVM version: 17.0.2
Steps to reproduce
Compile with wasi-sdk and run with Wasmer.
$ clang wasmer-creat.c $ mkdir -p tmptest $ wasmer run --dir . a.out
Expected behavior
This snippet should create a file
a
in thetmptest
directory.Actual behavior
Additional context
It seems the parent directory is resolved to the virtual root in the
path_open
handler. I'll be able to submit a patch.The text was updated successfully, but these errors were encountered: