-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
relpath broken for windows #23646
Comments
I think it's worth noting that the first result is entirely correct. While the default filesystem configuration is case-insensitive, the paths on that file system are still case-sensitive (and case-preserving). I agree the the results of the second two are malformed however. |
One other point to make about this issue: I found it because I was testing out a few changes I made in base by running all the julia tests, and one of them failed: the test set |
Yes, every PR needs to pass all tests on Windows via AppVeyor. Can you give more details about the failure you see? |
Sure, below is the test run (Julia 0.6.0, Windows 10): julia> include("c:/Users/testj6/AppData/Local/Julia-0.6.0/share/julia/test/libdl.jl")
Test Failed
Expression: dl != C_NULL
Evaluated: Ptr{Void} @0x0000000000000000 != Ptr{Void} @0x0000000000000000
ERROR: LoadError: There was an error during testing
while loading c:\Users\testj6\AppData\Local\Julia-0.6.0\share\julia\test\libdl.jl, in expression starting on line 23 |
Are you sure that failure is related to |
Yes, here are some
and here is the result of running the modified file:
|
Still seeing this on julia 1.02. Saw it when passing the build.jl of CxxWrap is passed an absolute path on a different drive. julia> relpath("c:/blah","d:/blah/bb")
"..\\..\\..\\c:\\blah" Update: just looked on master, and this is still a problem. |
still an issue in V1. 5. |
Someone with a Windows system should take a crack at this. |
According to the MSDN docs for comparisons, they should be case-insensitive:
I think we should respect this in |
Here are some test cases that also are bugs relpath("D","d") returns "..\\D" but should return `"."` (this is the case-insensitivity issue mentioned above)
relpath("d:x","d:a/b/c") returns "..\\..\\..\\d:x" but should return "..\\..\\..\\x" ("d:a/b/c" is a relative path in the current directory in the d drive)
(also test case sensitivity of the drive letters above)
I think we should probably first normalize the paths before doing path comparisons to fix these |
I also think we should just throw an error for examples like
path is on mount |
That documentation seems actively misleading, as it's not (or at least should not) be in the ".NET file system APIs", though it was once part of the local NTFS configuration. It's also entirely wrong now, since it's not even been part of the NTFS configuration for over 2 years (https://www.windowscentral.com/how-enable-ntfs-treat-folders-case-sensitive-windows-10). There's now a "fork this on github" button at the top if you're interested in fixing this confusing wording for future readers. I've been using that button a couple times lately to fix various documentations issues, to be able rely upon the functions not doing what they claimed. |
There's also this more detailed resource: https://devblogs.microsoft.com/commandline/per-directory-case-sensitivity-and-wsl/ |
In any case, let's keep case sensitivity as I agree that this is the safest from a user and dev perspective. However, we should still fix
and we should not allow cases like the following (i.e. we should throw an exception), although keeping the current behavior for now until agreed upon in a follow up after the bugs in this issue are fixed is a better option.
|
The
relpath
function does not seem to be working properly for Windows. The first two bad cases below are caused by a failure to be case-insensitive. The third bad case is caused by lack of recognition of drive letters.The text was updated successfully, but these errors were encountered: