Skip to content

Commit c9bc2ff

Browse files
authored
loading: fix finding bundled stdlibs even if they are e.g. devved in an environment higher in the load path (JuliaLang#52637)
I noticed this when seeing some weird precompile issues when I had SparseArrays devved in my main environment but it was with the standard stdlib format in the current environment: ``` (NearestNeighbors) pkg> st -m Project NearestNeighbors v0.4.15 Status `~/JuliaPkgs/NearestNeighbors.jl/Manifest.toml` ... [2f01184e] SparseArrays v1.10.0 ... ``` But even so, `locate_package` claims that the path to SparseArrays is the one in the main environment: ``` julia> pkg = Base.PkgId(Base.UUID("2f01184e-e22b-5df5-ae63-d93ebab69eaf"), "SparseArrays") SparseArrays [2f01184e-e22b-5df5-ae63-d93ebab69eaf] julia> Base.locate_package(pkg) "/home/kc/JuliaPkgs/SparseArrays.jl/src/SparseArrays.jl" ``` This correctly fixes it so that packages without a `git-tree-sha1` (and without a `path`) are resolved to the stdlib path.
1 parent f01898c commit c9bc2ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

base/loading.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,13 @@ function explicit_manifest_entry_path(manifest_file::String, pkg::PkgId, entry::
955955
return path
956956
end
957957
hash = get(entry, "git-tree-sha1", nothing)::Union{Nothing, String}
958-
hash === nothing && return nothing
958+
if hash === nothing
959+
mbypath = manifest_uuid_path(Sys.STDLIB, pkg)
960+
if mbypath isa String
961+
return entry_path(mbypath, pkg.name)
962+
end
963+
return nothing
964+
end
959965
hash = SHA1(hash)
960966
# Keep the 4 since it used to be the default
961967
uuid = pkg.uuid::UUID # checked within `explicit_manifest_uuid_path`

0 commit comments

Comments
 (0)