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

Prioritise gems with higher version for fetching metadata, and stop fetching once we find a valid candidate #4843

Merged
merged 1 commit into from Aug 19, 2021

Conversation

intuxicated
Copy link
Contributor

@intuxicated intuxicated commented Aug 15, 2021

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

Github has an issue in which it will generate a misleading prerelease output in its RubyGems server API and returns a 0 version for the gem while it doesn't exist.

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

Verifying metadata (which needs a network request to fetch the full gemspec) in order of priority until a valid gem is found, instead of fetching all gemspec candidates unconditionally, avoids the issue.

Fixes #4603.

Make sure the following tasks are checked

@intuxicated intuxicated force-pushed the dan/fix-issue-4585 branch 3 times, most recently from 3df0884 to e879849 Compare August 15, 2021 13:58
@intuxicated intuxicated changed the title Ignore Gem Version 0 when loading from a list Warn users when fetching a problematic github prerelease file Aug 15, 2021
@intuxicated intuxicated force-pushed the dan/fix-issue-4585 branch 3 times, most recently from 3561e3c to 06f018d Compare August 15, 2021 15:02
lib/rubygems/source.rb Outdated Show resolved Hide resolved
test/rubygems/test_gem_source_github_problem.rb Outdated Show resolved Hide resolved
test/rubygems/test_gem_source_github_problem.rb Outdated Show resolved Hide resolved
.github/workflows/cancel.yml Outdated Show resolved Hide resolved
@intuxicated intuxicated marked this pull request as ready for review August 15, 2021 15:26
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
@deivid-rodriguez deivid-rodriguez changed the title Warn users when fetching a problematic github prerelease file Fix gem install when index includes gems that don't exist but that don't affect resolution because there are other existing gems with more priority Aug 19, 2021
Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me!

I wasn't sure how to word the title, since this is technically independent from GitHub packages, although the realworld issue this is fixing is not being able to gem install from there. 🤔

@deivid-rodriguez deivid-rodriguez changed the title Fix gem install when index includes gems that don't exist but that don't affect resolution because there are other existing gems with more priority Prioritise gems with higher version for fetching metadata, and stop fetching once we find a valid candidate Aug 19, 2021
@intuxicated
Copy link
Contributor Author

:shipit:

@deivid-rodriguez deivid-rodriguez merged commit 2063a3e into rubygems:master Aug 19, 2021
@intuxicated intuxicated deleted the dan/fix-issue-4585 branch August 19, 2021 11:33
deivid-rodriguez added a commit that referenced this pull request Sep 2, 2021
Prioritise gems with higher version for fetching metadata, and stop fetching once we find a valid candidate

(cherry picked from commit 2063a3e)
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.

Cannot install ruby gem from rubygems.pkg.github.com without specifying the version.
4 participants