Fix PROFILE_ONLY_VARIABLES handling in the config constructor
authorZac Medico <zmedico@gentoo.org>
Wed, 21 Nov 2007 04:06:26 +0000 (04:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 21 Nov 2007 04:06:26 +0000 (04:06 -0000)
so that variables are appropriately filtered from "backupenv",
since otherwise they can leak in from there. (trunk r8524)

svn path=/main/branches/2.1.2/; revision=8567

pym/portage.py

index f0152e4f8cda546d6867d53a12b34688ca849fb3..2a28c52b729020c1fdf8372783d4dfc6f1b5940c 100644 (file)
@@ -1071,8 +1071,6 @@ class config:
                        self._use_wildcards = copy.deepcopy(clone._use_wildcards)
                else:
 
-                       # backupenv is for calculated incremental variables.
-                       self.backupenv = os.environ.copy()
                        if not local_config:
                                # Clean up pollution from portage_data so that it doesn't
                                # interfere with repoman.
@@ -1330,15 +1328,16 @@ class config:
                        self.configlist.append({})
                        self.configdict["auto"]=self.configlist[-1]
 
+                       # backupenv is used for calculating incremental variables.
+                       self.backupenv = os.environ.copy()
                        self.configlist.append(self.backupenv) # XXX Why though?
                        self.configdict["backupenv"]=self.configlist[-1]
 
-                       myenv = os.environ.copy()               
                        # Don't allow the user to override certain variables in the env
                        for k in profile_only_variables:
-                               myenv.pop(k, None)
+                               self.backupenv.pop(k, None)
 
-                       self.configlist.append(myenv)
+                       self.configlist.append(self.backupenv.copy())
                        self.configdict["env"]=self.configlist[-1]
                        if not local_config:
                                # Clean up pollution from portage_data so that it doesn't