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.
julia> relpath("c:/Users/vavasis/Documents", "c:/users/vavasis/Documents")
"..\\..\\..\\Users\\vavasis\\Documents"
julia> relpath("c:/Users/vavasis/Documents", "C:/users/vavasis/Documents")
"..\\..\\..\\..\\c:\\Users\\vavasis\\Documents"
julia> relpath("c:/Users/vavasis/Documents", "E:/")
"..\\c:\\Users\\vavasis\\Documents"
The first two bad cases below are caused by a failure to be case-insensitive
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 libdl.jl. At first I thought it failed because of the changes I made to base, but in fact the test set libdl.jl fails even in Julia-0.6.0 release due to this bug in relpath. I'm wondering how 0.6.0 was released even though libdl.jl fails. Does the release procedure including running tests in Windows?
Does the release procedure including running tests in Windows?
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 relpath? Have you tried adding a few show statements to see what path is used?
Yes, here are some println statements I added to libdl.jl:
C:\Users\testj6>fc c:\Users\Public\Documents\libdl.jl c:\Users\testj6\AppData\Local\Julia-0.6.0\share\julia\test\libdl.jl
Comparing files C:\USERS\PUBLIC\DOCUMENTS\libdl.jl and C:\USERS\TESTJ6\APPDATA\LOCAL\JULIA-0.6.0\SHARE\JULIA\TEST\LIBDL.JL
***** C:\USERS\PUBLIC\DOCUMENTS\libdl.jl
try
println("relpath = ", relpath(joinpath(private_libdir, "libccalltest")))
dl = Libdl.dlopen_e(relpath(joinpath(private_libdir, "libccalltest")))
***** C:\USERS\TESTJ6\APPDATA\LOCAL\JULIA-0.6.0\SHARE\JULIA\TEST\LIBDL.JL
try
dl = Libdl.dlopen_e(relpath(joinpath(private_libdir, "libccalltest")))
*****
***** C:\USERS\PUBLIC\DOCUMENTS\libdl.jl
@test dl != C_NULL
println("success A")
finally
***** C:\USERS\TESTJ6\APPDATA\LOCAL\JULIA-0.6.0\SHARE\JULIA\TEST\LIBDL.JL
@test dl != C_NULL
finally
*****
and here is the result of running the modified file:
julia> include("c:/Users/Public/Documents/libdl.jl")
relpath = ..\..\..\..\C:\Users\testj6\AppData\Local\Julia-0.6.0\bin\libccalltest
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\Public\Documents\libdl.jl, in expression starting on line 23
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.
Easy to replicate:
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.
Most helpful comment
Yes, here are some
printlnstatements I added tolibdl.jl:and here is the result of running the modified file: