[bitbake-devel] [PATCH] data: escape '$' in shell variable assignment

Richard Tollerton rich.tollerton at ni.com
Thu Dec 18 01:11:18 UTC 2014


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 at ni.com>
---
 lib/bb/data.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/bb/data.py b/lib/bb/data.py
index 6c8d644..e9d8290 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -242,6 +242,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
 
-- 
2.1.3




More information about the bitbake-devel mailing list