Skip to content

minimal evaluation for loading.jl makes Julia internals broken #903

@aviatesk

Description

@aviatesk

It seems like the minimal evaluation in Revise isn't working correctly against loading.jl (probably due to an issue with LoweredCodeUtils?).

I've confirmed that this problem exists in v1.12 with the master branch of Revise/LoweredCodeUtils.jl.
I've also seen the issue even when using the PR that updates LCU.jl to be compatible with 1.12.

We can reproduce the problem like this:
If we run maybe_extract_sigs! on loading.jl, the Pkg prompt gets messed up. After that, commands like st will result in errors.

julia> using Revise

julia> let pkgid = Revise.get_tracked_id(Base)
           filename = "loading.jl"
           pkgdata = Revise.pkgdatas[pkgid]
           Revise.maybe_extract_sigs!(Revise.maybe_parse_from_cache!(pkgdata, filename))
       end;
[ Info: tracking Base

pkg> st # weird things happen when entering pkg mode
ERROR: SystemError: getattrlist: Invalid argument
Stacktrace:
  [1] systemerror(p::Symbol, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:186
  [2] systemerror
    @ ./error.jl:185 [inlined]
  [3] isfile_casesensitive(path::String)
    @ Base ~/julia/julia4/base/loading.jl:56
  [4] active_project(search_load_path::Bool)
    @ Base ./initdefs.jl:347
  [5] active_project
    @ ./initdefs.jl:340 [inlined]
  [6] find_project_file(env::Nothing)
    @ Pkg.Types ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/Types.jl:203
  [7] Pkg.Types.EnvCache(env::Nothing)
    @ Pkg.Types ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/Types.jl:382
  [8] EnvCache
    @ ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/Types.jl:382 [inlined]
  [9] Context
    @ ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/Types.jl:444 [inlined]
 [10] status(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{IO}, kwargs::@Kwargs{})
    @ Pkg.API ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/API.jl:155
 [11] status(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/API.jl:153
 [12] do_cmd(command::Pkg.REPLMode.Command, io::Base.TTY)
    @ Pkg.REPLMode ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/REPLMode/REPLMode.jl:409
 [13] do_cmds(commands::Vector{Pkg.REPLMode.Command}, io::Base.TTY)
    @ Pkg.REPLMode ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/src/REPLMode/REPLMode.jl:395
 [14] do_cmds(repl::REPL.LineEditREPL, commands::String)
    @ REPLExt ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/ext/REPLExt/REPLExt.jl:99
 [15] on_done(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool, repl::REPL.LineEditREPL)
    @ REPLExt ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/ext/REPLExt/REPLExt.jl:113
 [16] apply_gr(::GlobalRef, ::Any, ::Vararg{Any})
    @ Base ./reflection.jl:1278
 [17] #invokelatest_gr#232
    @ ./reflection.jl:1285 [inlined]
 [18] invokelatest_gr
    @ ./reflection.jl:1281 [inlined]
 [19] (::REPLExt.var"#create_mode##0#create_mode##1"{REPL.LineEditREPL})(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ REPLExt ~/julia/julia4/usr/share/julia/stdlib/v1.12/Pkg/ext/REPLExt/REPLExt.jl:135
 [20] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/julia/julia4/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2852
 [21] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/julia/julia4/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1657
 [22] (::REPL.var"#61#62"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/julia/julia4/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:648

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions