commit:     cdcf8dfa018c2c40368a60e2cc44dcba7f9fa4f5
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  4 19:50:13 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Feb  4 19:50:13 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=cdcf8dfa

ebuild.repository: fix traversal from root of overlays

Resolves: https://github.com/pkgcore/pkgcheck/issues/418
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcore/ebuild/repository.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/pkgcore/ebuild/repository.py b/src/pkgcore/ebuild/repository.py
index ce61c4544..800e6e5dd 100644
--- a/src/pkgcore/ebuild/repository.py
+++ b/src/pkgcore/ebuild/repository.py
@@ -399,8 +399,10 @@ class UnconfiguredTree(prototype.tree):
             path_chunks = path.split(os.path.sep)
         else:
             path = os.path.realpath(os.path.abspath(path))
-            relpath = path[len(os.path.realpath(self.location)) :].strip("/")
-            path_chunks = relpath.split(os.path.sep)
+            if relpath := path[len(os.path.realpath(self.location)) 
:].strip("/"):
+                path_chunks = relpath.split(os.path.sep)
+            else:
+                path_chunks = ()
 
         if os.path.isfile(path):
             if not path.endswith(".ebuild"):

Reply via email to