WebAssembly / WebAssembly/wasi-libc
chdir("..") from "/bin" changes the current directory to "/bin/.." instead of "/"
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1k
- Forks
- 251
- Avg merge
- 7h 15m
- Merged PRs (30d)
- 3
Description
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 "/".
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with wasmtime run --mapdir /::testdir prog.wasm, then trace the WASI libc handling behind chdir() and getcwd(). Done means changing from /bin to .. reports / rather than /bin/.., with coverage for the mapped-root case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100