Skip to content
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

Module loading case-sensitivity windows inconsistency #31913

Open
ReubenHill opened this issue May 3, 2019 · 3 comments
Open

Module loading case-sensitivity windows inconsistency #31913

ReubenHill opened this issue May 3, 2019 · 3 comments
Labels
system:windows Affects only Windows

Comments

@ReubenHill
Copy link

From https://discourse.julialang.org/t/module-loading-case-sensitivity-on-windows/18523/5 :

On Windows 10 (x64), I create seqtest.jl in C:/Users/MyUserName/Desktop/test. This contains

module SeqTest

println("loaded SeqTest")

end # module SeqTest

in the same folder I create procmsgseqtest.jl which contains

module ProcMsgSeqTest

println("loaded ProcMsgSeqTest")

end # module ProcMsgSeqTest

Then in the Julia v1.0.2 (x64) REPL I do the following:

julia> push!(LOAD_PATH,"C:\\Users\\MyUserName\\Desktop\\test")
4-element Array{String,1}:
 "@"
 "@v#.#"
 "@stdlib"
 "C:\\Users\\MyUserName\\Desktop\\test"

julia> using SeqTest
ERROR: ArgumentError: Package SeqTest not found in current path:
- Run `import Pkg; Pkg.add("SeqTest")` to install the SeqTest package.

Stacktrace:
 [1] require(::Module, ::Symbol) at .\loading.jl:823

julia> using ProcMsgSeqTest
[ Info: Recompiling stale cache file C:\Users\MyUserName\.julia\compiled\v1.0\ProcMsgSeqTest.ji for ProcMsgSeqTest [top-level]
loaded ProcMsgSeqTest

This is also confirmed for Julia v.1.1.0 x64.

According to the documentation for Base.require, ProcMsgSeqTest should not load due to case sensitivity not being observed.

As @GregPlowman noted in the discourse discussion, this is due to the length of the file names exceeding 8 characters.

So it turns out that case-sensitive check works for SeqTest because it is short, whereas ProcMsgSeqTest is too long.

@stevengj stevengj added the system:windows Affects only Windows label May 3, 2019
@stevengj
Copy link
Member

stevengj commented May 3, 2019

As discussed in #30588, one alternative is to use longpath(shortpath(path)) instead of just longpath in isfile_casesensitive, but that will fail on volumes that have disabled short-name generation. Another alternative is to use realname(path), but I think that will fail for symbolic links?

Fortunately, the bug here apparently only creates false positives and not false negatives, so it won't cause module loading to fail in a case where it is supposed to succeed.

A third option is to use longpath(shortpath(path)), but punt and return true if that throws an error — this might have false positives on volumes that don't support short paths, but otherwise will work.

cc @malmaud, as this is a continuation of #13542.

@StefanKarpinski
Copy link
Member

I'm not sure if it's really worth the effort to guarantee an error in all these cases.

@vtjnash
Copy link
Member

vtjnash commented May 6, 2019

FWIW, it’s probably not just guaranteeing the error only, but also ensuring it keeps searching for the correct package and file (which probably won’t be found)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

4 participants