1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

Ensure only the filtered environment variables are inherited from the OS

The recent change which modified inheritFromOS to use the intial
environment, rather than the current environment, introduced a bug such
that variables which had been cleaned from the environment where still set
in the data store.

This patch changes things such that a list of approved environment
variables is saved after the environment is cleaned and only the variables
in this list are inherited in inheritFromOS.

CC: James Limbouris <james.limbouris@gmail.com>
CC: Chris Larson <clarson@kergoth.com>
(Bitbake rev: cb6c07054e8baf94614713ec257c643b22266d75)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock
2011-08-12 17:58:11 -07:00
committed by Richard Purdie
parent a6c48298b1
commit 61d83c6d6b
4 changed files with 29 additions and 18 deletions
+8 -7
View File
@@ -159,16 +159,17 @@ def expandKeys(alterdata, readdata = None):
ekey = todolist[key]
renameVar(key, ekey, alterdata)
def inheritFromOS(d, savedenv):
def inheritFromOS(d, savedenv, permitted):
"""Inherit variables from the initial environment."""
exportlist = bb.utils.preserved_envvars_exported()
for s in savedenv.keys():
try:
setVar(s, getVar(s, savedenv, True), d)
if s in exportlist:
setVarFlag(s, "export", True, d)
except TypeError:
pass
if s in permitted:
try:
setVar(s, getVar(s, savedenv, True), d)
if s in exportlist:
setVarFlag(s, "export", True, d)
except TypeError:
pass
def emit_var(var, o=sys.__stdout__, d = init(), all=False):
"""Emit a variable to be sourced by a shell."""