commit:     c6abd6be4c5fc3fb51288c7bb29d5f41c1f4107d
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 15 16:10:18 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 16 15:40:22 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c6abd6be

fix crash when using binhost due to using conditionally defined variable

extra_info didn't always exist, so if you get http 304 but no
Last-Modified, portage errors out with:

```
  File "/usr/lib/python3.13/site-packages/portage/dbapi/bintree.py", line 1519, 
in _populate_remote
    "up-to-date", extra_info
                  ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'extra_info' where it is not 
associated with a value
```

Fixes: c83466a50efdee2cac81a5ed6a660c11b9ac746e
Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>
Part-of: https://github.com/gentoo/portage/pull/1473
Closes: https://github.com/gentoo/portage/pull/1473
Signed-off-by: Sam James <sam <AT> gentoo.org>

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

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index f88d5e0aad..ebd0ec08c0 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1506,6 +1506,7 @@ class binarytree:
                             if (
                                 hasattr(err, "code") and err.code == 304
                             ):  # not modified (since local_timestamp)
+                                extra_info = ""
                                 if hasattr(err, "headers") and err.headers.get(
                                     "Last-Modified", ""
                                 ):

Reply via email to