[oe-commits] Richard Purdie : sshcontrol: Use os.environ.copy() instead of copy.copy()

git at git.openembedded.org git at git.openembedded.org
Fri Jul 31 09:44:00 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: 638cd44cc9a9eb435350aac7e8eeec585d74f8db
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=638cd44cc9a9eb435350aac7e8eeec585d74f8db

Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date:   Wed Jul 29 10:50:49 2015 +0100

sshcontrol: Use os.environ.copy() instead of copy.copy()

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 at linuxfoundation.org>

---

 meta/lib/oeqa/utils/sshcontrol.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py
index 4f8d3d2..6ed48ba 100644
--- a/meta/lib/oeqa/utils/sshcontrol.py
+++ b/meta/lib/oeqa/utils/sshcontrol.py
@@ -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



More information about the Openembedded-commits mailing list