-
Notifications
You must be signed in to change notification settings - Fork 485
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
Deleting a symlink actually deletes the target file #401
Comments
Thanks for the report. Looking at this now. |
Able to ReproduceI am able to reproduce your findings using the following steps:
By following these steps the file named AnalysisI ran the file system using the command line Below is an excerpt from the FileSpy log.
Log analysis:
According to the
Based on this documentation it looks like WinFsp/MEMFS interpret the instruction specified in line 367 correctly. If Explorer wants to delete Possible ResolutionThe question then becomes: why does Explorer send the wrong I do not know the reason for certain, but I have a suspicion. Notice that in line 364 Explorer sent us a While fixing issue #380 I added commit 3e66082. I suspect that the same commit may fix our problem as well. |
I can confirm that the upcoming release 2021.1 Beta3 (due for release later today) fixes this problem. Closing. Please reopen if you find that the problem is not fixed after trying release 2021.1 Beta3. |
I can also no longer reproduce the issue. Thanks a lot for the quick fix! |
Bug Report
When deleting a symlink in a WinFsp filesystem with Windows Explorer the symlink target is deleted instead. Deleting the link with other tools (cmd, etc.) works correctly. I first noticed this in my filesystem but it can also be reproduced with MEMFS.
I attached log files and traces from Process Monitor of the deletion process here: logs.zip
The files memfs-delete-symlink* are about the bug, the memfs-delete-file* ones are only for comparison and show the deletion of a normal file. The logs have separators (********) to highlight the actual deletion parts.
How to Reproduce
Behaviors
From what I have seen yet, my best guess is that it has to do with Windows Explorer using CreateFile with a Delete On Close option to delete a file. It then sees that the file is a symlink and tries the same thing again with the target file which results in the wrong file being deleted. In most cases this will probably result in data loss.
Environment
The text was updated successfully, but these errors were encountered: