From: Zac Medico Date: Thu, 5 Apr 2012 19:37:40 +0000 (-0700) Subject: Limit long slot conflict loop for bug #410801. X-Git-Tag: v2.2.0_alpha100~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eba99d86fe3bf43488c5df09419218d4b2941e90;p=portage.git Limit long slot conflict loop for bug #410801. --- diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py index 1d522aabd..a1c87146c 100644 --- a/pym/_emerge/resolver/slot_collision.py +++ b/pym/_emerge/resolver/slot_collision.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -80,6 +80,8 @@ class slot_conflict_handler(object): the needed USE changes and prepare the message for the user. """ + _check_configuration_max = 1024 + def __init__(self, depgraph): self.depgraph = depgraph self.myopts = depgraph._frozen_config.myopts @@ -663,14 +665,24 @@ class slot_conflict_handler(object): solutions = [] sol_gen = _solution_candidate_generator(all_involved_flags) - while(True): + checked = 0 + while True: candidate = sol_gen.get_candidate() if not candidate: break solution = self._check_solution(config, candidate, all_conflict_atoms_by_slotatom) + checked += 1 if solution: solutions.append(solution) - + + if checked >= self._check_configuration_max: + # TODO: Implement early elimination for candidates that would + # change forced or masked flags, and don't count them here. + if self.debug: + writemsg("\nAborting _check_configuration due to " + "excessive number of candidates.\n", noiselevel=-1) + break + if self.debug: if not solutions: writemsg("No viable solutions. Rejecting configuration.\n", noiselevel=-1)