From 3fe43d7dfd9228771daca82789295cceb5f37854 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 22 Aug 2017 12:01:35 -0700 Subject: alot/helper: Fix call_cmd_async polluting global environment An assignment `e = os.environ` creates a reference not a copy, which means that modifying one necessarily modifies the other. Using `dict.copy` creates a shallow copy (the keys and values are references, but the dicts are different objects), which means only modifications to mutable objects are shared. In the case of os.environ which only contains immutable objects like strings, bools, and numbers this isn't an issue. --- alot/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'alot/helper.py') diff --git a/alot/helper.py b/alot/helper.py index 4cd01b77..26787fa8 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -333,7 +333,7 @@ def call_cmd_async(cmdlist, stdin=None, env=None): self.deferred.errback(terminated_obj) d = Deferred() - environment = os.environ + environment = os.environ.copy() if env is not None: environment.update(env) logging.debug('ENV = %s', environment) -- cgit v1.2.3