commit:     08cdac85ffaf9b9915c40d9ffcd0ed3cf0e434d3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 10 14:56:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 19 19:14:29 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=08cdac85

repository: config: absorb all exceptions when determining volatility

Not ideal, but we don't have much else of a choice. It's a very
small section and trying to granularly specify the relevant exceptions
here is clearly a waste of time (see ref'd bugs).

Besides, the consequence is just failing-safe and assuming the repo
is volatile anyway.

Bug: https://bugs.gentoo.org/899208
Bug: https://bugs.gentoo.org/900683
Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/1005
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                             | 12 ++++++++++--
 lib/portage/repository/config.py |  9 ++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index a6daf1138..88296f690 100644
--- a/NEWS
+++ b/NEWS
@@ -1,15 +1,23 @@
+portage-3.0.45.3 (UNRELEASED)
+----------------
+
+Features:
 * New portage FEATURE warn-on-large-env, to emit a warning if portage
   executes an ebuild-related child process with a large environment.
 
+Bug fixes:
+* repository: config: Handle more error cases when determining repository
+  volatility (bug #900683).
+
 portage-3.0.45.2 (2023-03-04)
---------------
+----------------
 
 Bug fixes:
 * repository: config: Fix initial sync of repositories (bug #899208). 
Regression
   from portage-3.0.45, but the real bug is from portage-3.0.42.
 
 portage-3.0.45.1 (2023-02-27)
---------------
+----------------
 
 Bug fixes:
 * install-qa-check.d/90config-impl-decl: fix handling of non-ASCII quotes when

diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py
index 3d887ffaa..a01320fd7 100644
--- a/lib/portage/repository/config.py
+++ b/lib/portage/repository/config.py
@@ -361,7 +361,14 @@ class RepoConfig:
                     self.volatile = True
                 else:
                     self.volatile = False
-            except (FileNotFoundError, PermissionError):
+            except Exception:
+                # There's too many conditions here to refine the exception 
list:
+                # - We lack permissions to poke at the directory 
(PermissionError)
+                # - Its UID doesn't actually exist and the repository
+                #   won't be synced by the user (KeyError).
+                # - The directory doesn't exist (FileNotFoundError)
+                # - Probably many others.
+                # So, just fail safe.
                 self.volatile = True
 
         self.eapi = None

Reply via email to