diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-08 16:37:26 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-09 22:15:35 +0000 |
commit | f28f37220e7787721a31b659521a1c44ebea92bf (patch) | |
tree | 760825f1b04b179f4b338159dddb59c38e0246a9 /lib | |
parent | ac45ea848901b0f6cd23087b662dde8ce9cd807e (diff) | |
download | bitbake-f28f37220e7787721a31b659521a1c44ebea92bf.tar.gz |
data: Handle BASH_FUNC shellshock implication
The shellshock patches changed the way bash functions are exported.
Unfortunately different distros used slightly different formats,
Fedora went with BASH_FUNC_XXX()=() { echo foo; } and Ubuntu went with
BASH_FUNC_foo%%=() { echo foo; }.
The former causes errors in dealing with out output from emit_env,
the functions are not exported in either case any more.
This patch handles things so the functions work as expected in either
case.
[YOCTO #6880]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/data.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py index 91b1eb129..eb628c7df 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -219,6 +219,13 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): val = str(val) + if varExpanded.startswith("BASH_FUNC_"): + varExpanded = varExpanded[10:-2] + val = val[3:] # Strip off "() " + o.write("%s() %s\n" % (varExpanded, val)) + o.write("export -f %s\n" % (varExpanded)) + return 1 + if func: # NOTE: should probably check for unbalanced {} within the var o.write("%s() {\n%s\n}\n" % (varExpanded, val)) |