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

Rust's remove_dir_all is broken #3575

Closed
jcaesar opened this issue Feb 5, 2023 · 1 comment · Fixed by #4689
Closed

Rust's remove_dir_all is broken #3575

jcaesar opened this issue Feb 5, 2023 · 1 comment · Fixed by #4689
Assignees
Labels
bug Something isn't working 🕵️ needs investigation The issue/PR needs further investigation needs-tests priority-medium Medium priority issue 🏚 stale Inactive issues or PR
Milestone

Comments

@jcaesar
Copy link
Contributor

jcaesar commented Feb 5, 2023

Describe the bug

fd_readdir skips cookie directory entries. cookie is just an index into the sorted list of files in the directory. If that list changes between two fd_readdir calls, cookie won't refer to the intended continuation point.

echo (wasmer -V) \| (rustc -V) \| (uname -m)
wasmer 3.1.0 | rustc 1.67.0 (fc594f156 2023-01-24) (Arch Linux rust 1:1.67.0-2) | x86_64

Steps to reproduce

Prepare the following rust program:

fn main() {
    std::fs::remove_dir_all("foo/").expect("Foo gone");
}

(result)

Execute:

cargo build --target wasm32-wasi
mkdir foo/; touch foo/{bar,blubb,gah}
wasmer run target/wasm32-wasi/debug/remove\_dir\_all.wasm --mapdir .:.

Actual behavior

thread 'main' panicked at 'Foo gone: Os { code: 55, kind: Uncategorized, message: "Directory not empty" }', src/main.rs:8:37

and the file foo/gah will still remain.

Expected behavior

foo/ removed successfully.

Additional context

  • The behavior differs with --dir and --mapdir, both are broken.
  • wasmtime seems to have the exact same bug. Made me think it's a rust bug at first.
@jcaesar jcaesar changed the title remove_dir_all is broken with concurrent modification Rust's remove_dir_all is broken Feb 5, 2023
@ptitSeb ptitSeb added bug Something isn't working 🕵️ needs investigation The issue/PR needs further investigation needs-tests labels Feb 7, 2023
@ptitSeb ptitSeb added this to the v3.2 milestone Feb 7, 2023
@ptitSeb ptitSeb added the priority-medium Medium priority issue label Feb 7, 2023
@ptitSeb ptitSeb modified the milestones: v3.2, v3.3 Apr 13, 2023
@ptitSeb ptitSeb modified the milestones: v3.3, v4.0 Apr 20, 2023
@ptitSeb ptitSeb modified the milestones: v4.0, v4.x May 3, 2023
Copy link

stale bot commented May 3, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🕵️ needs investigation The issue/PR needs further investigation needs-tests priority-medium Medium priority issue 🏚 stale Inactive issues or PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants