Fix version ranges incorrectly handling platforms #6240
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
In certain cases, for example, when exactly pinning
nokogiri
in aGemfile
to1.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
and1.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