From: Daan De Meyer Date: Fri, 30 Aug 2024 09:49:20 +0000 (+0200) Subject: Don't change the working directory in chase() X-Git-Tag: v25~327^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2991%2Fhead;p=thirdparty%2Fmkosi.git Don't change the working directory in chase() --- diff --git a/mkosi/sandbox/__init__.py b/mkosi/sandbox/__init__.py index d42d556de..97e38c4f3 100644 --- a/mkosi/sandbox/__init__.py +++ b/mkosi/sandbox/__init__.py @@ -331,6 +331,7 @@ def userns_has_single_user() -> bool: def chase(root: str, path: str) -> str: + cwd = os.getcwd() fd = os.open("/", os.O_CLOEXEC | os.O_PATH | os.O_DIRECTORY) try: @@ -341,6 +342,7 @@ def chase(root: str, path: str) -> str: os.fchdir(fd) os.close(fd) os.chroot(".") + os.chdir(cwd) def splitpath(path: str) -> tuple[str, ...]: