summaryrefslogtreecommitdiff
path: root/lib/bundler/endpoint_specification.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-05-09 10:40:23 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-09-05 11:43:14 +0900
commitf7cf641469161c3770b58f79e08e312512212aa8 (patch)
tree3c3ee30585b64d5ef42e04eda0ffcb44b22290e3 /lib/bundler/endpoint_specification.rb
parent1420333455ba335f46887ee7a06c4ee95faa37ad (diff)
[rubygems/rubygems] Fix resolution hanging on musl platforms
After recent musl support was added, Bundler started hanging in musl platforms. I identified the issue where valid candidates were being filtered out because their platform was specified as a string, and thus `Gem::Platform.match_spec?` which under the hood ends up calling `Gem::Platform#===` would return `nil`, because it does not support comparing platforms to strings. In particular, `Bundler::EndpointSpecification`'s platform coming from the API was not instantiated as a `Gem::Platform`, hence the issue. Also, this spec surfaced another issue where a bug corrected in `Gem::Platform#match_platforms` had not been yet backported to Bundler. So this commit also backports that to get the spec green across RubyGems versions. Finally, the fix in `Bundler::EndpointSpecification` made a realworld spec start failing. This spec was faking out `rails-4.2.7.1` requirement on Bundler in the `Gemfile.lock` file to be `>= 1.17, < 3` when the real requirement is `>= 1.17, < 2`. Due to the bug in `Bundler::EndpointSpecification`, the real requirement provided by the compact index API (recorded with VCR) was being ignored, and the `Gemfile.lock` fake requirement was being used, which made the spec pass. This is all expected, and to fix the issue I changed the spec to be really realworld and don't fake any Bundler requirements. https://github.com/rubygems/rubygems/commit/faf4ef46bc
Diffstat (limited to 'lib/bundler/endpoint_specification.rb')
-rw-r--r--lib/bundler/endpoint_specification.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb
index ea197328ba..863544b1f9 100644
--- a/lib/bundler/endpoint_specification.rb
+++ b/lib/bundler/endpoint_specification.rb
@@ -12,7 +12,7 @@ module Bundler
super()
@name = name
@version = Gem::Version.create version
- @platform = platform
+ @platform = Gem::Platform.new(platform)
@spec_fetcher = spec_fetcher
@dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }