From: Daan De Meyer Date: Fri, 15 Nov 2024 11:05:53 +0000 (+0100) Subject: sandbox: Only create parent directories if dst does not exist yet X-Git-Tag: v25~171^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3196%2Fhead;p=thirdparty%2Fmkosi.git sandbox: Only create parent directories if dst does not exist yet --- diff --git a/mkosi/sandbox.py b/mkosi/sandbox.py index 47ea56493..0cb86378e 100755 --- a/mkosi/sandbox.py +++ b/mkosi/sandbox.py @@ -464,12 +464,12 @@ class BindOperation(FSOperation): if not os.path.exists(src) and not self.required: return - with umask(~0o755): - os.makedirs(os.path.dirname(dst), exist_ok=True) - if not os.path.exists(dst): isfile = os.path.isfile(src) + with umask(~0o755): + os.makedirs(os.path.dirname(dst), exist_ok=True) + with umask(~0o644 if isfile else ~0o755): if isfile: os.close(os.open(dst, os.O_CREAT | os.O_CLOEXEC | os.O_EXCL))