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 bundle update
not working on an out of sync lockfile
#7607
Fix bundle update
not working on an out of sync lockfile
#7607
Conversation
An old platform related bug fix made some existing lockfiles no longer work because they included invalid platforms. So to make it backwards compatible, code was added to remove invalid platforms from the lockfile before resolution. This is skipped though when Gemfile has changed dependencies because in that case we will be re-resolving anyways. However, in the `bundle update` case, the detection of "dependencies have changed" was not actually working making Bundler remove all platforms and not be able to resolve.
3f49b3e
to
6452adf
Compare
Works in my test scenario in #7585: # Gemfile
source 'https://rubygems.org'
gem "nokogiri", ">=1.16.4"
# Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
nokogiri (1.16.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.4-arm-linux)
racc (~> 1.4)
nokogiri (1.16.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86-linux)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
racc (~> 1.4)
racc (1.7.3)
PLATFORMS
aarch64-linux
arm-linux
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux
DEPENDENCIES
nokogiri (>= 1.16.4)
BUNDLED WITH
2.6.0.dev After # Gemfile
source 'https://rubygems.org'
gem "nokogiri", ">=1.16.4"
gem "prism", ">=0.25.0"
# Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
nokogiri (1.16.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.4-arm-linux)
racc (~> 1.4)
nokogiri (1.16.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86-linux)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
racc (~> 1.4)
prism (0.27.0)
racc (1.7.3)
PLATFORMS
aarch64-linux
arm-linux
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux
DEPENDENCIES
nokogiri (>= 1.16.4)
prism (>= 0.25.0)
BUNDLED WITH
2.6.0.dev Diff diff --git a/Gemfile.lock.before b/Gemfile.lock.after
index c8b6a99..4dca0bf 100644
--- a/Gemfile.lock.before
+++ b/Gemfile.lock.after
@@ -13,6 +13,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
racc (~> 1.4)
+ prism (0.27.0)
racc (1.7.3)
PLATFORMS
@@ -25,6 +26,7 @@ PLATFORMS
DEPENDENCIES
nokogiri (>= 1.16.4)
+ prism (>= 0.25.0)
BUNDLED WITH
2.6.0.dev |
Also tested with my application. I hit a strange error with one of our git-based gems, but then when I removed the Gemfile.lock it worked fine. I'll keep trying to see if that is a "real" issue or not. |
Ok I double checked my application, and it was my error. bundler tries to use whatever version is in the lockfile, so my before/after tests were both using 2.5.9. If I hardcoded the bundler version into the update command in the "after" (e.g. |
…date-deleting-platforms Fix `bundle update` not working on an out of sync lockfile (cherry picked from commit 1d8f066)
What was the end-user or developer problem that led to this PR?
A multiplatform lockfile may fail to
bundle update
when the Gemfile dependencies have been edited.What is your fix for the problem, implemented in this PR?
We fixed a issue related to lockfile platforms a while ago, but that implied that some existing lockfiles would have invalid platforms and no longer work. To make that fix backwards compatible I added code to cleanup those invalid platforms before resolving.
That cleanup should be skipped though in some cases, like when dependencies have been added to the Gemfile, because those dependencies won't be valid for any platform since they have not be resolved yet.
The code to skip cleanup in the above case was not correct for situations when
bundle update
has been run, hence causing this problem.The fix is to correct "dependencies have changed" detection for the
bundle update
case.Fixes #7585.
Make sure the following tasks are checked