commit: 94c8ecf59c7832c1eec039d50cc68c3092992f76 Author: Florian Schmaus <flow <AT> gentoo <DOT> org> AuthorDate: Fri Feb 20 10:54:02 2026 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Feb 20 13:05:54 2026 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=94c8ecf5
bintree: fix logic to not use local pkgindex if remote index is not found Portage would use the local pkgindex even if the remote index is not found. This is because of faulty logic which was essentially remote_pkgidx == Packages.gz and isinstance(err, FileNotFoundError) or 404 when it should be remote_pkgidx == Packages.gz and (isinstance(err, FileNotFoundError) or 404) Thanks to Kerin Millar for reporting this and Jethro Donaldson for suggesting the fix. Suggested-by: Jethro Donaldson <devel <AT> jro.nz> Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> Closes: https://bugs.gentoo.org/970223 Part-of: https://github.com/gentoo/portage/pull/1556 Closes: https://github.com/gentoo/portage/pull/1556 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/dbapi/bintree.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index d0a70bcbd1..86faf9e910 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -1636,9 +1636,8 @@ class binarytree: extra_info = f" (local: {local_iso_time}, remote: {remote_iso_time})" raise UseCachedCopyOfRemoteIndex("up-to-date", extra_info) - if ( - remote_pkgindex_file == "Packages.gz" - and isinstance(err, FileNotFoundError) + if remote_pkgindex_file == "Packages.gz" and ( + isinstance(err, FileNotFoundError) or ( isinstance(err, urllib.error.HTTPError) and err.code == 404
