From cdcf8dfa018c2c40368a60e2cc44dcba7f9fa4f5 Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Sat, 4 Feb 2023 21:50:13 +0200 Subject: [PATCH] ebuild.repository: fix traversal from root of overlays Resolves: https://github.com/pkgcore/pkgcheck/issues/418 Signed-off-by: Arthur Zamarin --- 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 @@ def path_restrict(self, path): 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"):