Fix broken escaping of commands in the build
authorLuke Drummond <luke.drummond@codeplay.com>
Fri, 16 Dec 2016 16:38:25 +0000 (16:38 +0000)
committerLuke Drummond <luke.drummond@codeplay.com>
Fri, 16 Dec 2016 16:38:25 +0000 (16:38 +0000)
commitc3d0165c494a6323a8e293cf1b3b3e46764be095
treeaf9d71f1d07f439ca9e8a7d2e3c408738baa32a6
parent35f21cba1304f989fd755fc44992142f9cecbc65
Fix broken escaping of commands in the build

A combination of broken escaping in CMake and in the python swig
generation scripts meant that the swig generation step would fail
whenever there were spaces or special characters in parameters passed to
swig.

The fix for this in CMakeLists is to use the VERBATIM option on all
COMMAND-based custom builders relying on CMake to properly escape each
argument in the generated file.

Within the python swig scripts, the fix is to call subprocess.Popen with
a list of raw argument strings rather than ones that are incorrectly
manually escaped, then passed to a shell subprocess via
subprocess.Popen(' '.join(params)). This also prevents nasty things
happening such as accidental command-injection.

This allows us to have the swig / python executables in paths containing
special chars and spaces, (or on shared storage on Win32, e.g
\\some\path or C:\Program Files\swig\swig.exe).

Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D26757

llvm-svn: 289956
lldb/CMakeLists.txt
lldb/scripts/CMakeLists.txt
lldb/scripts/Python/prepare_binding_Python.py