diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-03-16 17:45:54 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-04-06 13:07:16 +0900 |
commit | f3d69bed626e3326959dd62dbcc9ac4510e42b2f (patch) | |
tree | f7d1ff117d67bcb4d0e2c14f5844c5fe0d9e2241 /spec | |
parent | c257380965bcf93c9bef330faa6762ed0be494b5 (diff) | |
download | ruby-f3d69bed626e3326959dd62dbcc9ac4510e42b2f.tar.gz |
[rubygems/rubygems] Fix resolver hangs when dealing with an incomplete lockfile
While working on locking multiple platforms by default, I got an
infinite resolution loop in one of our resolver specs.
The culprit ended up being that when dealing with lockfile specs with
incomplete dependencies (spec appears in lockfile, but its dependencies
don't), those specs were not being properly expired and that tripped up
resolution.
The issue for some reason only manifests when dealing with multiple
lockfile platforms, that's why it only manifested when working on
locking multiple platforms by default.
https://github.com/rubygems/rubygems/commit/4ca72913bb
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index 126853e35f..85b3d4a075 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -1008,6 +1008,29 @@ RSpec.describe "bundle lock" do So, because Gemfile depends on rails >= 7.0.2.3, version solving has failed. ERR + + lockfile lockfile.gsub(/PLATFORMS\n #{lockfile_platforms}/m, "PLATFORMS\n #{lockfile_platforms("ruby")}") + + bundle "lock", :raise_on_error => false + + expect(err).to eq <<~ERR.strip + Could not find compatible versions + + Because rails >= 7.0.3.1, < 7.0.4 depends on activemodel = 7.0.3.1 + and rails >= 7.0.2.3, < 7.0.3.1 depends on activemodel = 7.0.2.3, + rails >= 7.0.2.3, < 7.0.4 requires activemodel = 7.0.2.3 OR = 7.0.3.1. + And because every version of activemodel depends on activesupport = 6.0.4, + rails >= 7.0.2.3, < 7.0.4 requires activesupport = 6.0.4. + Because rails >= 7.0.3.1, < 7.0.4 depends on activesupport = 7.0.3.1 + and rails >= 7.0.2.3, < 7.0.3.1 depends on activesupport = 7.0.2.3, + rails >= 7.0.2.3, < 7.0.4 requires activesupport = 7.0.2.3 OR = 7.0.3.1. + Thus, rails >= 7.0.2.3, < 7.0.4 cannot be used. + And because rails >= 7.0.4 depends on activemodel = 7.0.4, + rails >= 7.0.2.3 requires activemodel = 7.0.4. + So, because activemodel = 7.0.4 could not be found in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally + and Gemfile depends on rails >= 7.0.2.3, + version solving has failed. + ERR end it "does not accidentally resolves to prereleases" do |