commit:     cc372a52ee2aba153c0d7c2290306b7f623e8b7c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  9 23:58:07 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Dec 10 01:27:43 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cc372a52

bindbapi: add SIZE to _pkg_str_aux_keys

The _pkg_str_aux_keys are used inside dbapi.update_ents,
and need to contain SIZE in order for the fakedbapi
_instance_key_multi_instance method to operate correctly.

Incorrect operation of _instance_key_multi_instance could
prevent binarytree.inject from removing an old instance
from its internal state. It could also trigger a KeyError
in bindbapi.aux_update as in bug 918597, since it could
cause binarytree.getname to return a non-existent path.
It could also cause binarytree.getname to return an
existing but incorrect path, which might trigger an
InvalidBinaryPackageFormat exception as in bug 906675.

Bug: https://bugs.gentoo.org/906675
Bug: https://bugs.gentoo.org/918597
Bug: https://bugs.gentoo.org/919668
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index a6e1f9773d..9c9ac66334 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -84,9 +84,12 @@ class bindbapi(fakedbapi):
     _known_keys = frozenset(
         list(fakedbapi._known_keys) + ["CHOST", "repository", "USE"]
     )
+    # Must include keys used to create _pkg_str attributes used in
+    # the fakedbapi _instance_key_multi_instance method.
     _pkg_str_aux_keys = fakedbapi._pkg_str_aux_keys + (
         "BUILD_ID",
         "BUILD_TIME",
+        "SIZE",
         "_mtime_",
     )
 

Reply via email to