From 2272117b407f14abea1bf91e12ffcd39a39cc20f Mon Sep 17 00:00:00 2001 From: "Dr. Jens Harbott" Date: Tue, 3 May 2022 20:52:09 +0200 Subject: [PATCH] Avoid infinite loop in find_zuul_yaml() Currently there will be an infinite loop when no zuul config can be found. Terminate the loop when we reach the filesystem root. Signed-off-by: Dr. Jens Harbott Change-Id: I074f23eeac82531024cd1af0eeb7c502555eacd7 --- zuul_sphinx/zuul.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zuul_sphinx/zuul.py b/zuul_sphinx/zuul.py index f578884..bb669be 100644 --- a/zuul_sphinx/zuul.py +++ b/zuul_sphinx/zuul.py @@ -79,7 +79,7 @@ class ZuulDirective(Directive): def find_zuul_yaml(self): root = self.state.document.settings.env.relfn2path('.')[1] - while root: + while root and root != '/': for fn in ['zuul.yaml', '.zuul.yaml', 'zuul.d', '.zuul.d']: path = os.path.join(root, fn) if os.path.exists(path):