Skip to content

Project precompilation fails on 1.11.0-alpha2 if Project.toml contains "name" but no UUID #53788

@abraemer

Description

@abraemer

I found a regression from 1.11.0-alpha1 to 1.11.0-alpha2 (both installed via juliaup) concerning the precompilation of a project (not a package). I am not sure whether to report here or in the repository of Pkg.jl. Please tell me if I should open an issue there.

Consider the following (essentially empty) Project.toml

name = "MWE"

Trying to instantiate this Project.toml works under 1.11.0-alpha1 and fails with 1.11.0-alpha2.

1.11.0-alpha1
~/julia$ julia +1.11.0-alpha1 --startup=no
             _
  _       _ _(_)_     |  Documentation: https://docs.julialang.org
 (_)     | (_) (_)    |
  _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
 | | | | | | |/ _` |  |
 | | |_| | | | (_| |  |  Version 1.11.0-alpha1 (2024-03-01)
_/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.11) pkg> activate MWE
Activating project at `~/julia/MWE`

(MWE) pkg> instantiate
No Changes to `~/julia/MWE/Project.toml`
No Changes to `~/julia/MWE/Manifest.toml`

1.11.0-alpha2
~/julia$ julia +1.11 --startup=no
             _
 _       _ _(_)_     |  Documentation: https://docs.julialang.org
(_)     | (_) (_)    |
 _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` |  |
| | |_| | | | (_| |  |  Version 1.11.0-alpha2 (2024-03-18)
_/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.11) pkg> activate MWE
Activating project at `~/julia/MWE`

(MWE) pkg> instantiate
No Changes to `~/julia/MWE/Project.toml`
No Changes to `~/julia/MWE/Manifest.toml`
ERROR: MethodError: Cannot `convert` an object of type Nothing to an object of type Base.UUID
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
Base.UUID(::Any)
 @ Base uuid.jl:9
convert(::Type{T}, ::T) where T
 @ Base Base.jl:126

Stacktrace:
[1] setindex!(h::Dict{Base.UUID, Vector{Base.UUID}}, v0::Vector{Base.UUID}, key0::Nothing)
  @ Base ./dict.jl:346
[2] Base.Precompilation.ExplicitEnv(envpath::String)
  @ Base.Precompilation ./precompilation.jl:175
[3] Base.Precompilation.ExplicitEnv()
  @ Base.Precompilation ./precompilation.jl:29
[4] precompilepkgs(pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, timing::Bool, _from_loading::Bool, configs::Pair{Cmd, Base.CacheFlags}, io::Base.TTY, fancyprint::Bool)
  @ Base.Precompilation ./precompilation.jl:365
[5] (::Pkg.API.var"#227#228"{Bool, Bool, Bool, Bool, Bool, Pair{Cmd, Base.CacheFlags}, Vector{Pkg.Types.PackageSpec}})()
  @ Pkg.API ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/API.jl:1158
[6] activate(f::Pkg.API.var"#227#228"{Bool, Bool, Bool, Bool, Bool, Pair{Cmd, Base.CacheFlags}, Vector{Pkg.Types.PackageSpec}}, new_project::String)
  @ Pkg.API ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/API.jl:1379
[7] precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, configs::Pair{Cmd, Base.CacheFlags}, kwargs::@Kwargs{})
  @ Pkg.API ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/API.jl:1156
[8] _auto_precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; warn_loaded::Bool, already_instantiated::Bool)
  @ Pkg ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/Pkg.jl:837
[9] instantiate(ctx::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Base.BinaryPlatforms.Platform, allow_build::Bool, allow_autoprecomp::Bool, kwargs::@Kwargs{})
  @ Pkg.API ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/API.jl:1197
[10] instantiate
  @ ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/API.jl:1172 [inlined]
[11] instantiate(; kwargs::@Kwargs{})
  @ Pkg.API ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/API.jl:1171
[12] do_cmd(command::Pkg.REPLMode.Command, io::Base.TTY)
  @ Pkg.REPLMode ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/REPLMode/REPLMode.jl:404
[13] do_cmds(commands::Vector{Pkg.REPLMode.Command}, io::Base.TTY)
  @ Pkg.REPLMode ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/src/REPLMode/REPLMode.jl:393
[14] do_cmds(repl::REPL.LineEditREPL, commands::String)
  @ REPLExt ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/REPLExt.jl:92
[15] (::REPLExt.var"#31#34"{REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
  @ REPLExt ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/REPLExt.jl:122
[16] #invokelatest#2
  @ ./essentials.jl:1030 [inlined]
[17] invokelatest
  @ ./essentials.jl:1027 [inlined]
[18] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
  @ REPL.LineEdit ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2748
[19] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
  @ REPL ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1407
[20] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
  @ REPL ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:457

Note that this can be fixed by either putting a UUID into Project.toml or removing the name. All other "metadata" entries (being authors and version) don't seem to impact the observed behavior. It seems that Pkg.jl now assumes that uuid is set if name is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions