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

Fix filesystem access when running python with wasmer run-unstable . #3920

Merged
merged 19 commits into from
May 30, 2023

Conversation

Michael-F-Bryan
Copy link
Contributor

@Michael-F-Bryan Michael-F-Bryan commented May 26, 2023

This fixes wasmer run-unstable . for CPython by...

Context

When you are setting up a WASI instance and add a BinaryPackage to a WasiEnv (e.g. via WasiEnvBuilder::use_webc()), we will merge the package's filesystem (i.e. all its volumes, and those of its dependencies) into the root filesystem being constructed for our new WASI instance (WasiFsRoot).

When you use the sandboxed filesystem (a virtual_fs::TmpFileSystem) via WasiEnvBuilder::set_sandbox_fs(), this merging is done like normal because TmpFileSystem has a very efficient union() method.

However, we don't get that unioning behaviour when the user supplies their own filesystem instance. Instead, the WASI instance will use an opaque WasiFsRoot::Backing and the only way for that package's files to become available is by manually copying the bytes from each file across (that's what this PR is doing).

The Python use case wasn't working because #3852 left that manual copy operation as a TODO.

@Michael-F-Bryan Michael-F-Bryan changed the title Finish implementing filesystem merging in WasiEnv::use_package() Fix filesystem access when running python with wasmer run-unstable . May 26, 2023
@Michael-F-Bryan Michael-F-Bryan marked this pull request as ready for review May 26, 2023 23:19
@Michael-F-Bryan Michael-F-Bryan merged commit 554b202 into master May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants