wasi-libc icon indicating copy to clipboard operation
wasi-libc copied to clipboard

chdir("..") from "/bin" changes the current directory to "/bin/.." instead of "/"

Open nickysn opened this issue 4 years ago • 2 comments

I've mapped a single directory (which contains a "bin" subdirectory) as "/" like that:

wasmtime run --mapdir /::testdir prog.wasm

On program start, getcwd() returns "/", which is expected. Calling chdir("bin") causes getcwd() to return "/bin", which is also expected. Then, calling chdir(".") causes getcwd() to still return "/bin", which is also expected and great. However, calling chdir("..") causes getcwd() to return "/bin/..". I think in this case, it should return "/".

nickysn avatar Oct 10 '21 00:10 nickysn

Forgot to say that I'm using wasi-sdk 12.0

nickysn avatar Oct 10 '21 00:10 nickysn

the issue still open on wasi-sdk-21

tkernelcn avatar Jan 19 '24 07:01 tkernelcn