Skip to content

Commit

Permalink
protect against PkgId and UUID being imported and losing Base prefix …
Browse files Browse the repository at this point in the history
…in create_expr_cache (#53387)

Fixes #53381
  • Loading branch information
IanButterworth authored Feb 22, 2024
1 parent 8425b0e commit a1db8da
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,7 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
error("LOAD_PATH entries cannot contain $(repr(path_sep))")

deps_strs = String[]
# protects against PkgId and UUID being imported and losing Base prefix
function pkg_str(_pkg::PkgId)
if _pkg.uuid === nothing
"Base.PkgId($(repr(_pkg.name)))"
Expand All @@ -2651,6 +2652,9 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
for (pkg, build_id) in concrete_deps
push!(deps_strs, "$(pkg_str(pkg)) => $(repr(build_id))")
end
deps_eltype = sprint(show, eltype(concrete_deps); context = :module=>nothing)
deps = deps_eltype * "[" * join(deps_strs, ",") * "]"
precomp_stack = "Base.PkgId[$(join(map(pkg_str, vcat(Base.precompilation_stack, pkg)), ", "))]"

if output_o !== nothing
@debug "Generating object cache file for $(repr("text/plain", pkg))"
Expand All @@ -2662,8 +2666,6 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
opts = `-O0 --output-ji $(output) --output-incremental=yes`
end

deps_eltype = sprint(show, eltype(concrete_deps); context = :module=>nothing)
deps = deps_eltype * "[" * join(deps_strs, ",") * "]"
trace = isassigned(PRECOMPILE_TRACE_COMPILE) ? `--trace-compile=$(PRECOMPILE_TRACE_COMPILE[])` : ``
io = open(pipeline(addenv(`$(julia_cmd(;cpu_target)::Cmd)
$(flags)
Expand All @@ -2679,7 +2681,7 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
# write data over stdin to avoid the (unlikely) case of exceeding max command line size
write(io.in, """
empty!(Base.EXT_DORMITORY) # If we have a custom sysimage with `EXT_DORMITORY` prepopulated
Base.track_nested_precomp($(vcat(Base.precompilation_stack, pkg)))
Base.track_nested_precomp($precomp_stack)
Base.precompiling_extension = $(loading_extension)
Base.include_package_for_output($(pkg_str(pkg)), $(repr(abspath(input))), $(repr(depot_path)), $(repr(dl_load_path)),
$(repr(load_path)), $deps, $(repr(source_path(nothing))))
Expand Down

4 comments on commit a1db8da

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@vtjnash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your job failed.

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.