Skip to content

Commit 2920936

Browse files
fredrikekreKristofferC
authored andcommitted
[loading] Search in Sys.STDLIB if name/uuid is known. (#39572)
Locating a package with known uuid means the uuid was either found in a manifest in LOAD_PATH or a "package folder" in LOAD_PATH. However, looking up the package entrypoint fails for stdlibs that are not in the sysimage, even if they have been explicitly added to project/manifest by the user. This patch allows looking in Sys.STDLIB after stdlibs, fixes #39504. (cherry picked from commit 5d7e13f)
1 parent d330214 commit 2920936

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

base/loading.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ function locate_package(pkg::PkgId)::Union{Nothing,String}
290290
path = manifest_uuid_path(env, pkg)
291291
path === nothing || return entry_path(path, pkg.name)
292292
end
293+
# Allow loading of stdlibs if the name/uuid are given
294+
# e.g. if they have been explicitly added to the project/manifest
295+
path = manifest_uuid_path(Sys.STDLIB::String, pkg)
296+
path === nothing || return entry_path(path, pkg.name)
293297
end
294298
return nothing
295299
end

test/cmdlineargs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`
7171
end
7272
let v = readchomperrors(`$exename -i -e '
7373
empty!(LOAD_PATH)
74+
@eval Sys STDLIB=mktempdir()
7475
Base.unreference_module(Base.PkgId(Base.UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils"))
7576
'`)
7677
# simulate not having a working version of InteractiveUtils,

0 commit comments

Comments
 (0)