Fix dependency source bug in bundler #9213
Open
+132
−1
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.
I stumbled across a bundler bug that had me scratching my head for awhile, because I hadn't experienced it before.
In some cases when changing the source in a gemfile from a
Source::Gemspecto either aSource::PathorSource::Gitonly the parent gem will have it's gem replaced and updated and the child components will retain the original version. This only happens if the gem version of theSource::GemspecandSource::Gitare the same. It also requires another gem to share a dependency with the one being updated.For example if I have the following gemfile:
Rails has a component called
actionpackwhichpropshaftdepends on.If I change
railsto point at a git source (or path source), only the path forrailsgets updated:Because
actionpackis a dependency ofpropshaft, it will remain in the rubygems source in the lock file WHILE the other gems are correctly pointing to the git source.Gemfile.lock:
The gemfile will contain
actionpackin the rubygems source, but will be missing in the git source so the path will be incorrect. A bundle show on Rails will point to the correct place:but a bundle show on actionpack will be incorrect:
This bug requires the following to reproduce:
bundlewill only update the path for Rails component gems if no other gem depends on it.This incorrectly leaves Rails (or any gem like it) using two different codepaths / gem source code.
What was the end-user or developer problem that led to this PR?
What is your fix for the problem, implemented in this PR?
Make sure the following tasks are checked