From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BF445138BF3 for ; Sun, 16 Feb 2014 17:25:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5DA6DE0B7A; Sun, 16 Feb 2014 17:25:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D47ABE0B7A for ; Sun, 16 Feb 2014 17:25:54 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9495133F616 for ; Sun, 16 Feb 2014 17:25:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 2A5471872B for ; Sun, 16 Feb 2014 17:25:52 +0000 (UTC) From: "Sebastian Luther" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sebastian Luther" Message-ID: <1392567254.292633baa2cc5091b1cc4b8d8a89f5c2fe28ca9e.few@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py pym/portage/tests/resolver/test_slot_collisions.py X-VCS-Directories: pym/portage/tests/resolver/ pym/_emerge/ X-VCS-Committer: few X-VCS-Committer-Name: Sebastian Luther X-VCS-Revision: 292633baa2cc5091b1cc4b8d8a89f5c2fe28ca9e X-VCS-Branch: master Date: Sun, 16 Feb 2014 17:25:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d6c68b68-6949-4691-93e6-82a66e81e6b5 X-Archives-Hash: 192f99362dec31c97626d2156e91a31e commit: 292633baa2cc5091b1cc4b8d8a89f5c2fe28ca9e Author: Sebastian Luther gmx de> AuthorDate: Sun Feb 16 16:14:14 2014 +0000 Commit: Sebastian Luther gmx de > CommitDate: Sun Feb 16 16:14:14 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=292633ba Fix crash in depgraph._remove_pkg Make sure we don't try to remove a packages twice. This happened in the past when a package was its own digraph-child. One way to trigger this is a DEPEND on itself as in the test case. This bug was reported by slyfox on IRC. In his case the cause for the self-edge is unknown. Unfortunately the system state is lost. --- pym/_emerge/depgraph.py | 9 ++++++- pym/portage/tests/resolver/test_slot_collisions.py | 31 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 2ed7aeb..9698607 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2388,8 +2388,15 @@ class depgraph(object): Remove a package and all its then parentless digraph children from all depgraph datastructures. """ + debug = "--debug" in self._frozen_config.myopts + if debug: + writemsg_level( + "Removing package: %s\n" % pkg, + level=logging.DEBUG, noiselevel=-1) + try: - children = self._dynamic_config.digraph.child_nodes(pkg) + children = [child for child in self._dynamic_config.digraph.child_nodes(pkg) \ + if child is not pkg] self._dynamic_config.digraph.remove(pkg) except KeyError: children = [] diff --git a/pym/portage/tests/resolver/test_slot_collisions.py b/pym/portage/tests/resolver/test_slot_collisions.py index fdd6dd6..85afc09 100644 --- a/pym/portage/tests/resolver/test_slot_collisions.py +++ b/pym/portage/tests/resolver/test_slot_collisions.py @@ -226,3 +226,34 @@ class SlotCollisionTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + + + def testSelfDEPENDRemovalCrash(self): + """ + Make sure we don't try to remove a packages twice. This happened + in the past when a package had a DEPEND on itself. + """ + ebuilds = { + "dev-libs/A-1": { "RDEPEND": "=dev-libs/X-1" }, + "dev-libs/B-1": { "RDEPEND": "dev-libs/X" }, + + "dev-libs/X-1": { }, + "dev-libs/X-2": { "DEPEND": ">=dev-libs/X-2" }, + } + + test_cases = ( + ResolverPlaygroundTestCase( + ["dev-libs/A", "dev-libs/B"], + all_permutations = True, + success = True, + ignore_mergelist_order = True, + mergelist = ["dev-libs/X-1", "dev-libs/A-1", "dev-libs/B-1"]), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.cleanup()