]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
data: escape '$' in shell variable assignment
authorRichard Tollerton <rich.tollerton@ni.com>
Thu, 18 Dec 2014 01:11:18 +0000 (19:11 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Dec 2014 10:24:45 +0000 (10:24 +0000)
Running bitbake inside make results in the exported environment variable
MAKEOVERRIDES="${-*-command-variables-*-}", which the shell chokes on
when trying to expand it. But of course, it probably shouldn't have been
trying to expand it in the first place -- so just escape the dollar
sign.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/data.py

index eb628c7df35da67f1c532310c476296448d7658c..82eefef1a60dbfbc4946bd01bd2f82333f9eb76d 100644 (file)
@@ -238,6 +238,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
     # to a shell, we need to escape the quotes in the var
     alter = re.sub('"', '\\"', val)
     alter = re.sub('\n', ' \\\n', alter)
+    alter = re.sub('\\$', '\\\\$', alter)
     o.write('%s="%s"\n' % (varExpanded, alter))
     return 0