From: Daan De Meyer Date: Sat, 12 Aug 2023 20:57:41 +0000 (+0200) Subject: Use copy.deepcopy() to copy os.environ X-Git-Tag: v16~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06eaadf1213763ecd6f9edc519fd4e2cd63d0966;p=thirdparty%2Fmkosi.git Use copy.deepcopy() to copy os.environ Otherwise any changes we make to os.environ propagate into our shallow copy. --- diff --git a/mkosi/util.py b/mkosi/util.py index 88a329f82..a71fec4ef 100644 --- a/mkosi/util.py +++ b/mkosi/util.py @@ -193,7 +193,7 @@ def flock(path: Path) -> Iterator[int]: @contextlib.contextmanager def scopedenv(env: Mapping[str, Any]) -> Iterator[None]: - old = copy.copy(os.environ) + old = copy.deepcopy(os.environ) os.environ |= env # python caches the default temporary directory so when we might modify TMPDIR we have to make sure it