Skip to content

Commit

Permalink
[rubygems/rubygems] Add naive infinite loop detection when fixing loc…
Browse files Browse the repository at this point in the history
…kfile dependencies

rubygems/rubygems@5e933968a2
  • Loading branch information
deivid-rodriguez authored and matzbot committed Nov 6, 2024
1 parent c79d236 commit 261f5d3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,18 @@ def filter_specs(specs, deps)
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

Expand Down

0 comments on commit 261f5d3

Please sign in to comment.