wasmerio / wasmer

🚀 The leading Wasm Runtime supporting WASIX and WASI
https://wasmer.io
MIT License
19.04k stars 814 forks source link

WASIX: Working Directory mismatch #5229

Closed theduke closed 1 week ago

theduke commented 2 weeks ago

There seems to be a problem with working directory handling in the runtime and in the WASIX libc.

To illustrate:

wasmer --dir . is supposed to mount the current dir at /home , and to set the working dir to /home.

wasmer run wasmer/python --dir . -- -c "import os; print(os.getcwd())"
> `/home`

This works correctly!

But: wasmer run wasmer/python --dir . -- -c "import os; os.makedirs('./test123)"

This succeeds, but the directory is not created on the host file system.

Investigation reveals that os.getcwd() here leads to the getcwd() syscall being invoked, so it returns the expected value. But the path_create syscall invoked actually uses the path /test123, so apth resolution logic in libc assumes the CWD to be /.