diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 5d26da7753..9ce38209d6 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -587,10 +587,18 @@ module Bundler end def materialize(dependencies) + # Tracks potential endless loops trying to re-resolve. + # TODO: Remove as dead code if not reports are received in a while + incorrect_spec = nil + specs = begin resolve.materialize(dependencies) rescue IncorrectLockfileDependencies => e - reresolve_without([e.spec]) + spec = e.spec + raise "Infinite loop while fixing lockfile dependencies" if incorrect_spec == spec + + incorrect_spec = spec + reresolve_without([spec]) retry end