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

Add support for WASI opening Unix special files #1566

Merged
merged 7 commits into from
Aug 31, 2020

Conversation

MarkMcCaskey
Copy link
Contributor

@MarkMcCaskey MarkMcCaskey commented Aug 26, 2020

Resolves #1565

Review

  • Add a short description of the the change to the CHANGELOG.md file

@MarkMcCaskey MarkMcCaskey added 🎉 enhancement New feature! 📦 lib-wasi About wasmer-wasi labels Aug 26, 2020
Mark McCaskey added 3 commits August 26, 2020 15:33
230a0fb78 Add test opening `/dev/null` on Unix

git-subtree-dir: tests/wasi-wast
git-subtree-split: 230a0fb78a0eb5252ab90cf2e7c064e3f0bfe2b1
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2020

Codecov Report

Merging #1566 into master will increase coverage by 0.26%.
The diff coverage is 28.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1566      +/-   ##
==========================================
+ Coverage   31.46%   31.73%   +0.26%     
==========================================
  Files         185      185              
  Lines       27294    27010     -284     
==========================================
- Hits         8589     8572      -17     
+ Misses      18705    18438     -267     
Impacted Files Coverage Δ
lib/wasi/src/state/mod.rs 26.74% <28.57%> (+0.62%) ⬆️
lib/compiler-llvm/src/trampoline/wasm.rs 72.88% <0.00%> (-0.46%) ⬇️
lib/compiler-llvm/src/object_file.rs 74.11% <0.00%> (-0.31%) ⬇️
...mpiler-cranelift/src/translator/func_translator.rs 79.54% <0.00%> (-0.23%) ⬇️
lib/engine-jit/src/engine.rs 39.47% <0.00%> (-0.19%) ⬇️
...mpiler-cranelift/src/translator/code_translator.rs 81.25% <0.00%> (-0.08%) ⬇️
lib/compiler-llvm/src/translator/abi.rs 88.14% <0.00%> (-0.05%) ⬇️
lib/cli/src/error.rs 0.00% <0.00%> (ø)
lib/cli/src/commands/run.rs 0.00% <0.00%> (ø)
lib/engine-native/src/artifact.rs 0.00% <0.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb49acd...723dd4e. Read the comment docs.

(map_dirs "/dev:/dev")
(assert_return (i64.const 0))
(assert_stdout "13\n")
)
Copy link
Contributor

Choose a reason for hiding this comment

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

newline please!

(map_dirs "/dev:/dev")
(assert_return (i64.const 0))
(assert_stdout "13\n")
)
Copy link
Contributor

Choose a reason for hiding this comment

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

newline please

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

self.create_inode_with_stat(kind, is_preopened, name, stat)
}

/// creates an inode with the given filestat and insert it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// creates an inode with the given filestat and insert it.
/// Creates an inode with the given filestat and insert it.

Rule of thumb is that either it's a sentence which starts with a capital and ends with a period (or question or exclamation mark) or it's a sentence fragment and has neither.

new_inode,
);
} else {
unreachable!(
Copy link
Contributor

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.

Copy link
Contributor Author

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 /.

@MarkMcCaskey MarkMcCaskey merged commit 686ea59 into master Aug 31, 2020
@bors bors bot deleted the feature/wasi-unix-special-files branch August 31, 2020 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-wasi About wasmer-wasi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening /dev/null leads to panic: not yet implemented
3 participants