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

Fix version ranges incorrectly handling platforms #6240

Merged
merged 2 commits into from
Jan 6, 2023

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Jan 5, 2023

What was the end-user or developer problem that led to this PR?

In certain cases, for example, when exactly pinning nokogiri in a Gemfile to 1.13.10, on Ruby 3.2, Bundler would not be able to properly fallback to the generic Ruby version when necessary (like here).

We did have some specs checking this, but not this particular situation. For example, in a similar situation, but using an open requirement instead of an exact requirement, Bundler does properly fallback, and we do have tests for that.

What is your fix for the problem, implemented in this PR?

For this kind of platform fallback, we use the trick of considering 1.13.10 and 1.13.10-x86_64-linux as separate versions, and the latter being "higher" than the former, in the sense that it's considered for resolution first even if they both have the same version.

However, we were considering these two separate resolution candidates when retrieving all possible versions for a gem, but not when creating version ranges for dependencies.

This PR ammends version range creation for dependencies, so that the ranges created properly include both generic variants and platform specific variants.

Fixes #6237.

Make sure the following tasks are checked

Dependency ranges were sometimes matching only the specific platform
variant of a given version. When transforming dependency requirements
into pub_grub version ranges, we need to make sure both the generic
version and the platform specific version can potentially match the
ranges we create. Otherwise we can't resolve sometimes.
@deivid-rodriguez
Copy link
Member Author

Upstream PR created: jhawthorn/pub_grub#22.

@deivid-rodriguez deivid-rodriguez merged commit b91ffa8 into master Jan 6, 2023
@deivid-rodriguez deivid-rodriguez deleted the fix-incorrect-version-ranges branch January 6, 2023 11:22
@flavorjones
Copy link
Contributor

Thank you, @deivid-rodriguez !

deivid-rodriguez added a commit that referenced this pull request Jan 6, 2023
Fix version ranges incorrectly handling platforms

(cherry picked from commit b91ffa8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bundler does not properly fallback to vanilla ruby platform package under some circumstances
3 participants