[PATCH 11/22] Handle the simple cases of environment modification.

David Shea dshea at redhat.com
Wed Jun 3 16:03:35 UTC 2015


Mark pre-thread environment modifications as safe in /sbin/anaconda and
anaconda-yum, and remove an unnecessary environment modification from
handle-sshpw.

This commit is partially from e05a0e433073331ccfb198bda2aeebfda6c44d7f

Related: rhbz#1188287
---
 anaconda             | 4 ++++
 scripts/anaconda-yum | 1 +
 utils/handle-sshpw   | 2 --
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/anaconda b/anaconda
index 09355eb..d8bad60 100755
--- a/anaconda
+++ b/anaconda
@@ -371,6 +371,10 @@ def setupPythonPath():
     sys.path.extend(ADDON_PATHS)
 
 def setupEnvironment():
+    # This method is run before any threads are started, so this is the one
+    # point where it's ok to modify the environment.
+    # pylint: disable=environment-modify
+
     # Silly GNOME stuff
     if 'HOME' in os.environ and not "XAUTHORITY" in os.environ:
         os.environ['XAUTHORITY'] = os.environ['HOME'] + '/.Xauthority'
diff --git a/scripts/anaconda-yum b/scripts/anaconda-yum
index 77067c7..965a4b1 100755
--- a/scripts/anaconda-yum
+++ b/scripts/anaconda-yum
@@ -82,6 +82,7 @@ def run_yum_transaction(release, arch, yum_conf, install_root, ts_file, script_l
     from yum.Errors import PackageSackError, RepoError, YumBaseError, YumRPMTransError
 
     # remove some environmental variables that can cause problems with package scripts
+    # pylint: disable=environment-modify
     env_remove = ('DISPLAY', 'DBUS_SESSION_BUS_ADDRESS')
     for k in env_remove:
         if k in os.environ:
diff --git a/utils/handle-sshpw b/utils/handle-sshpw
index 8965572..0616acf 100755
--- a/utils/handle-sshpw
+++ b/utils/handle-sshpw
@@ -52,5 +52,3 @@ for ud in userdata:
         kwargs = ud.__dict__
         kwargs.update({"root": "/", "mkmailspool": False})
         u.createUser(ud.username, **kwargs)
-
-del(os.environ["LIBUSER_CONF"])
-- 
2.1.0



More information about the anaconda-patches mailing list