diff --git a/base/loading.jl b/base/loading.jl index 86ffaef060f1d..289dab0bbfae0 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -749,7 +749,7 @@ function stale_cachefile(modpath::String, cachefile::String) end # now check if this file is fresh relative to its source files - if files[1][1] != modpath + if !samefile(files[1][1], modpath) DEBUG_LOADING[] && info("JL_DEBUG_LOADING: Rejecting cache file $cachefile because it is for file $(files[1][1])) not file $modpath.") return true # cache file was compiled from a different path end diff --git a/test/compile.jl b/test/compile.jl index 4e377126138ac..a8d4fbe2846af 100644 --- a/test/compile.jl +++ b/test/compile.jl @@ -205,6 +205,11 @@ try @test !isdefined(Main, :FooBar) @test !isdefined(Main, :FooBar1) + relFooBar_file = joinpath(dir, "subfolder", "..", "FooBar.jl") + @test Base.stale_cachefile(relFooBar_file, joinpath(dir, "FooBar.ji")) == !is_windows() # `..` is not a symlink on Windows + mkdir(joinpath(dir, "subfolder")) + @test !Base.stale_cachefile(relFooBar_file, joinpath(dir, "FooBar.ji")) + @eval using FooBar fb_uuid = Base.module_uuid(Main.FooBar) sleep(2); touch(FooBar_file)