https://bugs.winehq.org/show_bug.cgi?id=51443
Bug ID: 51443 Summary: Test fails in remove_dir_all crate when creating file Product: Wine Version: 6.12 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: mikrutrafal@protonmail.com Distribution: ---
Hi, Steps to reproduce on clear wine-devel 6.12 ``` wget https://static.rust-lang.org/dist/rust-1.53.0-x86_64-pc-windows-gnu.msi msiexec /i rust-1.53.0-x86_64-pc-windows-gnu.msi git clone https://github.com/XAMPPRocky/remove_dir_all.git cd remove_dir_all git checkout 9b164cecdb4a0590af68be8b22f9c747402237e3 wine cargo test ```
should print this ``` running 4 tests test removes_read_only ... FAILED test removes_empty ... ok test removes_files ... ok test removes_dirs ... ok
failures:
---- removes_read_only stdout ---- thread 'removes_read_only' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access denied." }', tests\windows.rs:68:49 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures: removes_read_only
test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
error: test failed, to rerun pass '--test windows'
```
I tested it and this works fine in Windows Server 2019
Source code of failed test - https://github.com/XAMPPRocky/remove_dir_all/blob/9b164cecdb4a0590af68be8b22...
``` fn removes_read_only() { env_logger::init(); for i in 0..5 { let path = format!("./readonly/{}/subdir", i);
fs::create_dir_all(&path).unwrap();
let file_path = format!("{}/file.txt", path); { let file = File::create(&file_path).unwrap(); ```
https://bugs.winehq.org/show_bug.cgi?id=51443
LingM lingm+winebz@posteo.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |lingm+winebz@posteo.org
--- Comment #1 from LingM lingm+winebz@posteo.org --- Created attachment 75017 --> https://bugs.winehq.org/attachment.cgi?id=75017 Cargo lock file
The instructions no longer work as written since several of the dependencies no longer support building with Rust 1.53. To ensure reproducible results, always include the Cargo.lock, which records the exact versions of the dependencies used.
I've manually downgraded the problematic crates and attached the resulting Cargo.lock. To use it, simply place it next to the Cargo.toml, which is provided in the git repository, before running `wine cargo test`.
As for the reported problem itself: Looks like it's fixed as of Wine 8.13. The assert a few lines later on line 92 gets triggered so the test still fails, but it successfully creates a file.
https://bugs.winehq.org/show_bug.cgi?id=51443
LingM lingm+winebz@posteo.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #75017|text/plain |application/octet-stream mime type| | Attachment #75017|Cargo lock file |Cargo.lock description| |
https://bugs.winehq.org/show_bug.cgi?id=51443
--- Comment #2 from LingM lingm+winebz@posteo.org --- Er, correction, nothing is fixed with Wine 8.13. The real problem has been the assert on line 92 firing all along.
What happened is that said assert firing killed the test and so the files it created didn't get cleaned up. When you run `wine cargo test` a second time the `readonly` folder it created still exists and you get the `PermissionDenied` error.