Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nightly: Cannot load Pkg and REPL in module on LOAD_PATH if REPLExt is in no environment #53365

Closed
pfitzseb opened this issue Feb 16, 2024 · 1 comment · Fixed by #53326
Closed
Assignees
Milestone

Comments

@pfitzseb
Copy link
Member

pfitzseb commented Feb 16, 2024

Repro:

  • Make sure your global env is empty.
  • Create a new package that depends on Pkg and REPL
  • Put that package on LOAD_PATH and try to using it:
❯ tree
.
└── Foo
    ├── Project.toml
    └── src
        └── Foo.jl

3 directories, 2 files

❯ cat Foo/Project.toml
name="Foo"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

❯ cat Foo/src/Foo.jl
module Foo

using REPL, Pkg

end

❯ ~/Documents/Git/julia/usr/bin/julia -e 'pushfirst!(LOAD_PATH, pwd()); using Foo'
┌ Error: Error during loading of extension REPLExt of Pkg, use `Base.retry_load_extensions()` to retry.
│   exception =
│    1-element ExceptionStack:
│    ArgumentError: Package REPLExt [e5eb5ef1-03cf-53a7-ae1d-5a66b08e832b] is required but does not seem to be installed:
│     - Run `Pkg.instantiate()` to install all recorded dependencies.
│
│    Stacktrace:
│      [1] _require(pkg::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:2152
│      [2] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:2033
│      [3] #invoke_in_world#3
│        @ ./essentials.jl:1064 [inlined]
│      [4] invoke_in_world
│        @ ./essentials.jl:1061 [inlined]
│      [5] _require_prelocked
│        @ ./loading.jl:2024 [inlined]
...
│     [25] _start()
│        @ Base ./client.jl:525
└ @ Base loading.jl:1426
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for Foo [a0f744ce-4535-5630-8809-367301d68e22]
│   exception = nothing
└ @ Base loading.jl:2222

In a way this direct LOAD_PATH manipulation is pretty unidiomatic, but it still feels like this shouldn't fail to me.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Feb 16, 2024

A lot of work on this in #53326, although the correct lookup of the extensions is still a broken aspect on that PR

vtjnash added a commit that referenced this issue Feb 23, 2024
…53326)

This bypasses DEPOT_PATH, LOAD_PATH, and stale checks when loading
known stdlib code for known purposes from known locations, specifically
to avoid the problem that I cannot fix my tools because I have used my
tools to break my tools.

This helps avoid the situation that the user can break important Pkg,
REPL, Socket or similar features simply because they chose to remove
`@stdlib` from their environment. For example, if you make an edit to
REPL, then this will trigger recompilation and load the edited version:
```
$ ./julia -e 'using REPL' -iq
┌ Info: Precompiling REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] (cache misses: include_dependency fsize change (2), invalid header (10), mismatched flags (1))
└ @ Base loading.jl:2643
julia>
```
But this will load the version that shipped with Julia, regardless of
the state of the cache or the source code (unless you delete the cache
files):
```
$ ./julia -iq
julia>
```

Fixes #53365
KristofferC pushed a commit that referenced this issue Feb 26, 2024
…53326)

This bypasses DEPOT_PATH, LOAD_PATH, and stale checks when loading
known stdlib code for known purposes from known locations, specifically
to avoid the problem that I cannot fix my tools because I have used my
tools to break my tools.

This helps avoid the situation that the user can break important Pkg,
REPL, Socket or similar features simply because they chose to remove
`@stdlib` from their environment. For example, if you make an edit to
REPL, then this will trigger recompilation and load the edited version:
```
$ ./julia -e 'using REPL' -iq
┌ Info: Precompiling REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] (cache misses: include_dependency fsize change (2), invalid header (10), mismatched flags (1))
└ @ Base loading.jl:2643
julia>
```
But this will load the version that shipped with Julia, regardless of
the state of the cache or the source code (unless you delete the cache
files):
```
$ ./julia -iq
julia>
```

Fixes #53365

(cherry picked from commit ea1a0d2)
tecosaur pushed a commit to tecosaur/julia that referenced this issue Mar 4, 2024
…uliaLang#53326)

This bypasses DEPOT_PATH, LOAD_PATH, and stale checks when loading
known stdlib code for known purposes from known locations, specifically
to avoid the problem that I cannot fix my tools because I have used my
tools to break my tools.

This helps avoid the situation that the user can break important Pkg,
REPL, Socket or similar features simply because they chose to remove
`@stdlib` from their environment. For example, if you make an edit to
REPL, then this will trigger recompilation and load the edited version:
```
$ ./julia -e 'using REPL' -iq
┌ Info: Precompiling REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] (cache misses: include_dependency fsize change (2), invalid header (10), mismatched flags (1))
└ @ Base loading.jl:2643
julia>
```
But this will load the version that shipped with Julia, regardless of
the state of the cache or the source code (unless you delete the cache
files):
```
$ ./julia -iq
julia>
```

Fixes JuliaLang#53365
mkitti pushed a commit to mkitti/julia that referenced this issue Mar 7, 2024
…uliaLang#53326)

This bypasses DEPOT_PATH, LOAD_PATH, and stale checks when loading
known stdlib code for known purposes from known locations, specifically
to avoid the problem that I cannot fix my tools because I have used my
tools to break my tools.

This helps avoid the situation that the user can break important Pkg,
REPL, Socket or similar features simply because they chose to remove
`@stdlib` from their environment. For example, if you make an edit to
REPL, then this will trigger recompilation and load the edited version:
```
$ ./julia -e 'using REPL' -iq
┌ Info: Precompiling REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] (cache misses: include_dependency fsize change (2), invalid header (10), mismatched flags (1))
└ @ Base loading.jl:2643
julia>
```
But this will load the version that shipped with Julia, regardless of
the state of the cache or the source code (unless you delete the cache
files):
```
$ ./julia -iq
julia>
```

Fixes JuliaLang#53365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants