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 fallback to the old index and installation from it not working #4213

Merged
merged 5 commits into from
Dec 31, 2020

Conversation

deivid-rodriguez
Copy link
Member

Creating tests for this was tricky 😅

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

The problem is that after we upgraded rubygems to pull dependencies from the new API, this has created problems for people using custom sources, since most custom sources don't yet implement the new compact index API.

In particular, the new API not being implemented causes rubygems to fallback to the old full index, which made 2 bugs surface as client crashes.

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

The first bug is the fallback to the old marshalled index not happening properly if the source url includes credentials. The fix for that is to make sure that uri comparison uses the original url before credential redaction.

The second bug, which surfaces after the first one is fixed, is that some old specs in the marshalled index have required_rubygems_version set to nil. Since the latest rubygems now (correctly) considers metadata during resolution, the check for this field was crashing since it wasn't expecting it to ever be nil.

Make sure the following tasks are checked

I had to update one test that was instantiating the `FetchError`
class passing a `nil` URI, since my solution requires duping the passed
URI, and you can't dup `nil` on ruby 2.3, apparently.
Initial versions of the Gem::Specification API didn't include the
`required_rubygems_version` field, so some marshalled specs have this
field set to nil.

Since we're now checking metadata during resolution, the check was
crashing for these old marshaled specs.
@deivid-rodriguez deivid-rodriguez merged commit cbc80b7 into master Dec 31, 2020
@deivid-rodriguez deivid-rodriguez deleted the fix_index_fallback branch December 31, 2020 11:51
deivid-rodriguez added a commit that referenced this pull request Dec 31, 2020
Fix fallback to the old index and installation from it not working

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

None yet

2 participants