When investigating bug 918597 I noticed some nasty inconsistencies with respect to binpkg-multi-instance in the global updates code and aux_update that can trigger problems related to pkgdir-index-trusted. For example, bindbapi.aux_update modifies that the file mtime without updating the mtime in the cpv instance that it passes to bintree.inject, and this is inconsistent because the mtime is part of the package key for binpkg-multi-instance. This affects dbapi.update_ents. Also, bintree.move_ent and bintree.move_slot_ent have similar problems to bindbapi.aux_update, where they modify the package without calling aux_update. Since the global update code calls bindbbapi.move_ent and bindbapi.move_slot_ent prior to update_ents, the inconsistency in those calls may have corrupted the information that update_ents is operating on.
It's not quite as bad as I thought, since "binpkg-multi-instance 3 of 7" had support to regenerate the cpv with a new stat result in binarytree.inject: https://gitweb.gentoo.org/proj/portage.git/commit/?id=328dd4712f88cbb8ef390ae9eb471afa1ef781d7 However, it's bad that bindbapi._pkg_str_aux_keys does not include the SIZE key, since that's used in fakedbapi._instance_key_multi_instance.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=cc372a52ee2aba153c0d7c2290306b7f623e8b7c commit cc372a52ee2aba153c0d7c2290306b7f623e8b7c Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2023-12-09 23:58:07 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2023-12-10 01:27:43 +0000 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@gentoo.org> lib/portage/dbapi/bintree.py | 3 +++ 1 file changed, 3 insertions(+)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d365d80099d206e49b592abb30030642f8f09f9 commit 0d365d80099d206e49b592abb30030642f8f09f9 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-12-10 22:34:47 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-12-10 22:34:52 +0000 sys-apps/portage: add 3.0.57 Closes: https://bugs.gentoo.org/918929 Closes: https://bugs.gentoo.org/913628 Closes: https://bugs.gentoo.org/915474 Closes: https://bugs.gentoo.org/918597 Closes: https://bugs.gentoo.org/919072 Closes: https://bugs.gentoo.org/919105 Closes: https://bugs.gentoo.org/919174 Closes: https://bugs.gentoo.org/919311 Closes: https://bugs.gentoo.org/919419 Closes: https://bugs.gentoo.org/919668 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.57.ebuild | 242 +++++++++++++++++++++++++++++++++ 2 files changed, 243 insertions(+)