-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Deletion of symbolic link directories is inconsistent across systems #13194
Comments
I think these are basically trying to mirror I'd err on the UNIX side of things. |
This successfully deletes the symlink directory without touching the target: > mkdir foo
> mklink /D bar foo
> rmdir bar On Windows, if a directory is given to Now CMD doesn't prevent you from creating a file symlink to a directory. It must then be deleted like a file and cannot be > mkdir foo
> mklink bar foo
> cd bar
The directory name is invalid.
> rmdir bar
The directory name is invalid.
> del bar The opposite is also true, you can create a directory symlink to a file: > echo 1 > foo
> mklink /D bar foo
> cd bar
The directory name is invalid.
> del bar
The directory name is invalid.
> rmdir bar |
I think we should stick with the current semantics, which are obviously inspired by Unix tools, and implement the same behaviour on Windows. |
So, am I getting this right? Windows
POSIX
This should make |
Looks good. The behaviour of works vs. does not work is identical on Windows on POSIX when expanding the |
The following will raise only on Windows, not on Unix-like systems:
Whereas the opposite holds for the following:
This might be due to the fact that "is a symbolic link" and "is a directory" are two distinct properties on Windows, rather than two values of a single property in POSIX. This is affecting the following spec since
FileUtils.rm_r
always callsFile.delete
on symlinks:crystal/spec/std/file_utils_spec.cr
Lines 242 to 265 in c931553
What is the desired behavior here?
The text was updated successfully, but these errors were encountered: