Skip to content

Data loss when moving directory on Windows #64

@rgwood

Description

@rgwood

Hi, we use fs_extra in Nushell; thanks for writing it!

We recently had a scary bug report, and it looks like the root cause is fs_extra::dir::move_dir(). If you use move_dir() to change the case of a directory name on Windows (ex: "Test" -> "test"), the directory is deleted and fs_extra reports success.

For example:

// This deletes the directory named Test and does not panic!
fs_extra::dir::move_dir("Test", "test", &options).unwrap();

Steps to Reproduce

I've put together a minimal repro: https://github.com/rgwood/fs-extra-repro

Version Info

fs-extra v1.2.0
Windows 11 (can't reproduce on Linux)
rustc v1.63.0

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions