nushell
                                
                                 nushell copied to clipboard
                                
                                    nushell copied to clipboard
                            
                            
                            
                        mv deleted folders, no error
Describe the bug
Tried to rename a couple of project folders to snake case versions. It succeeded on one, and deleted the other two.
Similar to #5296, except on Windows 10 and no error.
How to reproduce
- mkdir Test
- mv Test test
Expected behavior
I expected nu to report an error and not do anything, or rename the folder.
Screenshots
No response
Configuration
| key | value | 
|---|---|
| version | 0.68.1 | 
| branch | |
| commit_hash | e76b3d61deef832adce76b0f73f19131de8cbc9e | 
| build_os | windows-x86_64 | 
| build_target | x86_64-pc-windows-msvc | 
| rust_version | rustc 1.63.0 (4b91a6ea7 2022-08-08) | 
| rust_channel | stable-x86_64-pc-windows-msvc | 
| cargo_version | cargo 1.63.0 (fd9c4297c 2022-07-01) | 
| pkg_version | 0.68.1 | 
| build_time | 2022-09-08 21:41:56 +00:00 | 
| build_rust_channel | release | 
| features | database, dataframe, default, trash, which, zip | 
| installed_plugins | 
Additional context
No response
Yikes - we're very sorry about the data loss! Thank you for the bug report.
I can reproduce this on Windows but not Linux. Guessing it's related to the filesystem being case-insensitive on Windows. I'll take a closer look.
This is looking like a bug in a library we use - specifically the fs_extra::dir::move_dir() function. I'll put together a minimal repro and file an issue over there.
If fs_extra can't fix this before the next Nushell release (Sept 27), we might want to fork it.
I imagine this is an issue on all file systems with case-insensitivity.
And I know this seems to be a dependency issue, but I would still suggest to add additional test cases for similar scenarios, because deleting data like this absolutely shouldn't happen.
deleting data like this absolutely shouldn't happen.
Agreed. We'd very much welcome PRs in this area.
I've written up a few tests and will add them when the fs_extra fix is ready.
Just merged a fix for this, it will be included in the next version of Nushell.
To make a long story short, we no longer use the buggy dependency when doing a normal mv foo Foo. When the dependency is fixed, I'll upgrade our version of it as an extra safeguard.
Is this able to be closed now?
Probably not. We mostly worked around it on our side, but we can still call fs_extra in a fallback path. We might need to replace our use of fs_extra or submit a patch upstream.
I realise this happened to me before, never though this was the culprit 💀