Skip to content

Commit 9022969

Browse files
protect against PkgId and UUID being imported and losing Base prefix
1 parent 02699bb commit 9022969

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

base/loading.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,6 +2664,9 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
26642664

26652665
deps_eltype = sprint(show, eltype(concrete_deps); context = :module=>nothing)
26662666
deps = deps_eltype * "[" * join(deps_strs, ",") * "]"
2667+
# protect against PkgId and UUID being imported and losing Base prefix
2668+
precomp_stack_pkgs = map(p->"Base.PkgId(Base.UUID(\"$(p.uuid)\"), \"$(p.name)\")", vcat(Base.precompilation_stack, pkg))
2669+
precomp_stack = "Base.PkgId[$(join(precomp_stack_pkgs, ", "))]"
26672670
trace = isassigned(PRECOMPILE_TRACE_COMPILE) ? `--trace-compile=$(PRECOMPILE_TRACE_COMPILE[])` : ``
26682671
io = open(pipeline(addenv(`$(julia_cmd(;cpu_target)::Cmd)
26692672
$(flags)
@@ -2679,7 +2682,7 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
26792682
# write data over stdin to avoid the (unlikely) case of exceeding max command line size
26802683
write(io.in, """
26812684
empty!(Base.EXT_DORMITORY) # If we have a custom sysimage with `EXT_DORMITORY` prepopulated
2682-
Base.track_nested_precomp($(vcat(Base.precompilation_stack, pkg)))
2685+
Base.track_nested_precomp($precomp_stack)
26832686
Base.precompiling_extension = $(loading_extension)
26842687
Base.include_package_for_output($(pkg_str(pkg)), $(repr(abspath(input))), $(repr(depot_path)), $(repr(dl_load_path)),
26852688
$(repr(load_path)), $deps, $(repr(source_path(nothing))))

0 commit comments

Comments
 (0)