commit:     685908978c48f6bfeab99f47ba7d78ee00294a64
Author:     Tatsuyuki Ishi <ishitatsuyuki <AT> google <DOT> com>
AuthorDate: Wed May 15 07:46:36 2024 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 26 18:01:22 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=68590897

Fix a depgraph crash with useoldpkg and subslot bumps

This resolves a "list index out of range" error that could happen with
when a package's subslot is bumped and --useoldpkg is used.

Due to the subslot bump, the code will filter matched_packages to
only contain the latest version. However, this didn't update
matched_oldpkg, which would now contain stale packages and cause logic
errors.

Fix this by filtering matched_oldpkg again before its use.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki <AT> google.com>
Bug: https://bugs.gentoo.org/932804
Closes: https://github.com/gentoo/portage/pull/1322
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/depgraph.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 13add990e6..6b91d5c42d 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -8177,6 +8177,7 @@ class depgraph:
                     ):
                         return pkg, existing_node
 
+            matched_oldpkg = [x for x in matched_oldpkg if x in 
matched_packages]
             visible_matches = []
             if matched_oldpkg:
                 visible_matches = [

Reply via email to