]> code.ossystems Code Review - openembedded-core.git/commitdiff
sshcontrol: Use os.environ.copy() instead of copy.copy()
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 29 Jul 2015 09:50:49 +0000 (10:50 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 31 Jul 2015 09:31:03 +0000 (10:31 +0100)
os.environ is special and copy.copy() doesn't do what we'd expect,
changes in the child object change the parent. copy.deepcopy() is
also known to have issues with it.

Use the dedicated .copy() method which will not influence the
parent. This fixes selftest failures where the DISPLAY variable
disappears.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/sshcontrol.py

index 4f8d3d2c98f22892d25264bd7f3f4c449b14e45d..6ed48badc8958e614758d5dcda6ae0f7ca6895cc 100644 (file)
@@ -10,7 +10,6 @@ import subprocess
 import time
 import os
 import select
-import copy
 
 
 class SSHProcess(object):
@@ -33,7 +32,7 @@ class SSHProcess(object):
         self.logfile = None
 
         # Unset DISPLAY which means we won't trigger SSH_ASKPASS
-        env = copy.copy(os.environ)
+        env = os.environ.copy()
         if "DISPLAY" in env:
             del env['DISPLAY']
         self.options['env'] = env