Skip to content

Commit 2481fdf

Browse files
KristofferCKristofferC
authored andcommitted
loading: fix finding bundled stdlibs even if they are e.g. devved in an environment higher in the load path (#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. (cherry picked from commit c9bc2ff)
1 parent 7d3c68e commit 2481fdf

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
@@ -933,7 +933,13 @@ function explicit_manifest_entry_path(manifest_file::String, pkg::PkgId, entry::
933933
return path
934934
end
935935
hash = get(entry, "git-tree-sha1", nothing)::Union{Nothing, String}
936-
hash === nothing && return nothing
936+
if hash === nothing
937+
mbypath = manifest_uuid_path(Sys.STDLIB, pkg)
938+
if mbypath isa String
939+
return entry_path(mbypath, pkg.name)
940+
end
941+
return nothing
942+
end
937943
hash = SHA1(hash)
938944
# Keep the 4 since it used to be the default
939945
uuid = pkg.uuid::UUID # checked within `explicit_manifest_uuid_path`

0 commit comments

Comments
 (0)