Fix installation error of same version of default gems with local installation #6430
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?
When we try to install local gem like
pkg/bigdecimal-3.1.4.gemwith Ruby 3.3.0-dev(ruby/ruby master version). RubyGems always fail with the following error.https://github.com/ruby/bigdecimal/actions/runs/4269574995/jobs/7432842358
What is your fix for the problem, implemented in this PR?
This is too complex condition. The assumption is that
jsonis default gems(bigdecimal-3.1.4 didn't release yet, I showed same example with json),https://github.com/rubygems/rubygems/blob/master/lib/rubygems/request_set.rb#L183 is always true when it's given same name and same version.
When we try to install via rubygems.org like
gem i json -v 2.6.3, It's working fine. When we use remote installation, gemspec isAPISpecificationin https://github.com/rubygems/rubygems/blob/master/lib/rubygems/request_set.rb#L184 like:This gemspec don't have
Gem::Specificaiton#extensionslike:Because https://github.com/rubygems/rubygems/blob/master/lib/rubygems/specification.rb#L1607 is skip to this
Gem::Specification#build_extensionsand download, build, install after that.But when we invoke
gem i pkg/json-2.6.3.gem, we haveLocalSpecificationlike:This gemspec have full spec of
Gem::Specification:So,
Gem::Specification#build_extensionstry to build this spec despite there is no files of json-2.6.3.I added guard condition to
Gem::Specification#build_extensionsfor fullname of default gems.Make sure the following tasks are checked