]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use copy.deepcopy() to copy os.environ
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 12 Aug 2023 20:57:41 +0000 (22:57 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Sun, 13 Aug 2023 08:24:25 +0000 (10:24 +0200)
Otherwise any changes we make to os.environ propagate into our
shallow copy.

mkosi/util.py

index 88a329f824ae493d26dd782d428da75c8e1005c3..a71fec4efdf4eabda7898a6c4dcbeedb4bd359d6 100644 (file)
@@ -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