[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

Luke Drummond via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 16 11:37:36 PST 2016


ldrumm created this revision.
ldrumm added reviewers: zturner, granata.enrico.
ldrumm added a subscriber: LLDB.
Herald added a subscriber: mgorny.

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).


https://reviews.llvm.org/D26757

Files:
  CMakeLists.txt
  scripts/CMakeLists.txt
  scripts/Python/prepare_binding_Python.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26757.78228.patch
Type: text/x-patch
Size: 6272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161116/946fb5a2/attachment.bin>


More information about the lldb-commits mailing list