Bug 1455065 - Shell quote environment variable values when dumping them in dump_env.py. r?build
The mozconfig output parsing code already handles shell quoted strings
to some extent (except for
bug 818377), because that's what `set`
outputs. By quoting environment variable values, we avoid a bunch of
problems with "weird" values.
--- a/python/mozbuild/mozbuild/action/dump_env.py
+++ b/python/mozbuild/mozbuild/action/dump_env.py
@@ -1,10 +1,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# We invoke a Python program to dump our environment in order to get
# native paths printed on Windows so that these paths can be incorporated
# into Python configure's environment.
import os
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from shellutil import quote
+
for key, value in os.environ.items():
- print('%s=%s' % (key, value))
+ print('%s=%s' % (key, quote(value)))