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

Base.BinaryPlatforms.select_platform broken on master and 1.9 #49491

Closed
giordano opened this issue Apr 24, 2023 · 3 comments · Fixed by #49502
Closed

Base.BinaryPlatforms.select_platform broken on master and 1.9 #49491

giordano opened this issue Apr 24, 2023 · 3 comments · Fixed by #49502
Labels
regression Regression in behavior compared to a previous version
Milestone

Comments

@giordano
Copy link
Contributor

Reproducer:

using Pkg, Base.BinaryPlatforms, Artifacts

mktempdir() do dir
    Pkg.activate(dir) do
        name = "Zlib_jll"
        spec = PackageSpec(
            ;
            name,
            uuid = "83775a58-1f1d-513f-b197-d71354ab007a",
            tree_hash = Base.SHA1("3c163199e21e5a0bab8881d6794496d02f28013d"),
            repo = Pkg.Types.GitRepo(
                ;
                rev="2a651eb0845ad1aeb4f65f17669216698cc216b2",
                source="https://github.com/JuliaBinaryWrappers/Zlib_jll.jl.git"
            ),
        )
        dep_path = Pkg.Operations.find_installed(name, spec.uuid, spec.tree_hash)
        artifacts_toml = joinpath(dep_path, "Artifacts.toml")
        platform = Platform("x86_64", "linux"; sanitize="memory")
        artifact_meta(name[1:end-4], artifacts_toml; platform)
    end
end

Expected output (and actual output on Julia v1.8):

Dict{String, Any} with 6 entries:
  "arch"          => "x86_64"
  "git-tree-sha1" => "d5fb5e2a1b66832e6c1a7234bc674e1e0e3eb0e9"
  "libc"          => "glibc"
  "download"      => Any[Dict{String, Any}("sha256"=>"13bffbc5a168fe4095553aec25c2d56102d8721330cb79b62f2359006432f748", "url"=>"https://github.com/JuliaBinaryWrappers/Zlib_jll.jl/releases/download/Zlib-v1.2.1…
  "os"            => "linux"
  "sanitize"      => "memory"

Actual output:

Dict{String, Any} with 5 entries:
  "arch"          => "x86_64"
  "git-tree-sha1" => "981cf7f0dcc3e5981e98dc47845f43ea8a07d5e0"
  "libc"          => "glibc"
  "download"      => Any[Dict{String, Any}("sha256"=>"d79c9a6ac68fc363ce55b881bcfb2667829172af7113ba187ddbb6dfef36a4a6", "url"=>"https://github.com/JuliaBinaryWrappers/Zlib_jll.jl/releases/download/Zlib-v1.2.1…
  "os"            => "linux"

Likely culprit: #48749. CC: @staticfloat

@giordano giordano added the regression Regression in behavior compared to a previous version label Apr 24, 2023
@giordano giordano added this to the 1.10 milestone Apr 24, 2023
@giordano
Copy link
Contributor Author

giordano commented Apr 24, 2023

Actually, it's BinaryPlatforms.select_platform which is broken. Much simpler reproducer, based on

# The new "prefer shortest matching" algorithm is meant to be used to resolve ambiguities such as the following:
platforms = Dict(
# Typical binning test
P("x86_64", "linux") => "good",
P("x86_64", "linux"; sanitize="memory") => "bad",
)
@test select_platform(platforms, P("x86_64", "linux")) == "good"

julia> platforms = Dict(
               Platform("x86_64", "linux") => "bad",
               Platform("x86_64", "linux"; sanitize="memory") => "good",
           )
Dict{Platform, String} with 2 entries:
  Linux x86_64 {libc=glibc, sanitize=memory} => "good"
  Linux x86_64 {libc=glibc}                  => "bad"

julia> select_platform(platforms, Platform("x86_64", "linux"; sanitize="memory"))
"bad"

@giordano giordano changed the title Artifacts.artifact_meta broken on master Base.BinaryPlatforms.artifact_meta broken on master Apr 24, 2023
@giordano giordano modified the milestones: 1.10, 1.9 Apr 24, 2023
@giordano giordano changed the title Base.BinaryPlatforms.artifact_meta broken on master Base.BinaryPlatforms.select_platform broken on master Apr 24, 2023
@giordano giordano changed the title Base.BinaryPlatforms.select_platform broken on master Base.BinaryPlatforms.select_platform broken on master and 1.9 Apr 24, 2023
@KristofferC
Copy link
Member

So do you want to revert #48749 for 1.9 then?

@giordano
Copy link
Contributor Author

I think that PR was meant to fix #42299 (comment), but that isn't merged yet, so reverting it should be safe for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants