-
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
Add support for WASI opening Unix special files #1566
Changes from all commits
88c1f6d
6327fa6
ed74a83
ed0acc2
0d16267
e4e41f4
723dd4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,8 @@ And here's an example of how to generate these tests: | |
cargo run -- -as # set up the toolchains for all targets | ||
cargo run -- -ag # generate the WASI tests for all targets | ||
``` | ||
|
||
## Updating in Wasmer | ||
|
||
Run | ||
`git subtree pull --prefix tests/wasi-wast [email protected]:wasmerio/wasi-tests master --squash` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(wasi_test "unix_open_special_files.wasm" | ||
(map_dirs "/dev:/dev") | ||
(assert_return (i64.const 0)) | ||
(assert_stdout "13\n") | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline please! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// WASI: | ||
// mapdir: /dev:/dev | ||
|
||
use std::fs; | ||
use std::io::Write; | ||
|
||
fn main() { | ||
let mut f = fs::OpenOptions::new() | ||
.write(true) | ||
.open("/dev/null") | ||
.unwrap(); | ||
let result = f.write(b"hello, world!").unwrap(); | ||
println!("{}", result); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(wasi_test "unix_open_special_files.wasm" | ||
(map_dirs "/dev:/dev") | ||
(assert_return (i64.const 0)) | ||
(assert_stdout "13\n") | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are generated files, I can regenerate them all but it'd probably be best to do that separately |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment, I'm not sure whether this is reachable or not? If the place in the wasi-fs where the host path is being injected is controlled by the user then it seems like it should be a full Err? Otherwise, if this is part of mirroring the host paths then this is fine as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be reachable without unsafe I believe: it's not possible to put files in the virtual root right now, they have to come from a preopened directory and that directory will be mounted at
/
.