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

Attempt to fix BB julia_version issue #2942 #2963

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function deps_graph(env::EnvCache, registries::Vector{Registry.RegistryInstance}
# unregistered stdlib we must special-case it here. This is further
# complicated by the fact that we can ask this question relative to
# a Julia version.
if is_unregistered_stdlib(uuid) || uuid_is_stdlib
if (is_unregistered_stdlib(uuid) || uuid_is_stdlib) && haskey(stdlibs(), uuid)
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused, as far as I can tell, this branch should already be false:

julia> using Pkg
       uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f")
       stdlibs_for_julia_version = Pkg.Types.get_last_stdlibs(v"1.6.0")
       haskey(stdlibs_for_julia_version, uuid)
true

julia> stdlibs_for_julia_version = Pkg.Types.get_last_stdlibs(v"1.7.0")
       haskey(stdlibs_for_julia_version, uuid)
false

julia> Pkg.Types.is_unregistered_stdlib(uuid)
false

Copy link
Author

Choose a reason for hiding this comment

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

But the error occurs when doing:

Pkg.add(Pkg.Types.Context(; julia_version = v"1.6"), [PackageSpec(; name = "libjulia_jll")])

So uuid_is_stdlib is true, and it tries to get the project file from an stdlib that is no longer there and crashes.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (is_unregistered_stdlib(uuid) || uuid_is_stdlib) && haskey(stdlibs(), uuid)
if (is_unregistered_stdlib(uuid) || uuid_is_stdlib) && haskey(stdlibs(), uuid)
# if the dependency is still a stdlib in the current running version of Julia it doesn't need to be downloaded

@barche does this seem correct?

Although, I don't understand how the correct version is installed for the target julia version if it's different to the one provided by the host Julia

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I think this is a correct summary. It's true that there could be edge cases where this gets an incompatible version of an stdlib, but only in the case where a package is requested for a julia version that is different from the running version. I don't know how to deal with that and I'd propose to tackle that problem when and if it ever occurs.

Copy link
Member

Choose a reason for hiding this comment

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

@staticfloat it'd be good to get your take on this part too.

Although, I don't understand how the correct version is installed for the target julia version if it's different to the one provided by the host Julia

path = Types.stdlib_path(stdlibs_for_julia_version[uuid][1])
proj_file = projectfile_path(path; strict=true)
@assert proj_file !== nothing
Expand Down
5 changes: 5 additions & 0 deletions test/resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,11 @@ end
mpfr = find_by_name(versions, "MPFR_jll")
@test mpfr !== nothing
@test mpfr.version.major == 4 && mpfr.version.minor == 0

# Test for issue #2942
libjulia_jll = "libjulia_jll"
Pkg.add(Pkg.Types.Context(; julia_version = v"1.6"), [PackageSpec(; name = libjulia_jll)])
@test isinstalled(libjulia_jll)
end
end

Expand Down