bytecodealliance / bytecodealliance/wasmtime

wasip1 path_remove_directory fails with paths with trailing slashes

Open
#11,524 4 comments 0 reactions 1 assignee Claimed by @sunfishcode View on GitHub
bug wasi wasi:impl
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

### Test Case

For the wasi-testsuite test [remove_directory_trailing_slashes](https://github.com/WebAssembly/wasi-testsuite/blob/main/tests/rust/src/bin/remove_directory_trailing_slashes.rs#L19), we mkdir `dir.cleanup`, then try to rrmdir `dir.cleanup/` (note trailing slash). This fails because it uses the "get the parent then remove the leaf" strategy, and the parent of `dir.cleanup/` is `dir.cleanup`, and the leaf is `.`.

A trace: https://github.com/WebAssembly/wasi-testsuite/issues/101#issuecomment-3214123363

I would expect that the rmdir removes trailing slashes.

Filing this bug here as I am not sure if this is a failure of cap-std or if callers are required to remove trailing slashes already.

### Versions and Environment

Wasmtime version or commit: 1a88c70a6ec088ee213658488549306f8951405d (august 19)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.