[libcxx-commits] [libcxx] f8452dd - [libc++] Use proper shell escaping in the executors
Shoaib Meenai via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 17 14:30:57 PDT 2020
subprocess.list2cmdline might be useful here. It's undocumented (or at least it was at some point), but it's designed for this.
On 4/17/20, 1:46 PM, "libcxx-commits on behalf of Louis Dionne via libcxx-commits" <libcxx-commits-bounces at lists.llvm.org on behalf of libcxx-commits at lists.llvm.org> wrote:
Author: Louis Dionne
Date: 2020-04-17T16:46:43-04:00
New Revision: f8452ddfcc3336e42544a35481507f0b3bae423e
URL: https://github.com/llvm/llvm-project/commit/f8452ddfcc3336e42544a35481507f0b3bae423e
DIFF: https://github.com/llvm/llvm-project/commit/f8452ddfcc3336e42544a35481507f0b3bae423e.diff
LOG: [libc++] Use proper shell escaping in the executors
Added:
Modified:
libcxx/utils/run.py
libcxx/utils/ssh.py
Removed:
################################################################################
diff --git a/libcxx/utils/run.py b/libcxx/utils/run.py
index 7cdf65264ec0..e9f9859807b3 100644
--- a/libcxx/utils/run.py
+++ b/libcxx/utils/run.py
@@ -14,6 +14,7 @@
import argparse
import os
+import pipes
import shutil
import subprocess
import sys
@@ -57,8 +58,9 @@ def main():
else:
shutil.copy2(dep, args.execdir)
- # Run the executable with the given environment in the execution directory.
- return subprocess.call(' '.join(remaining), cwd=args.execdir, env=env, shell=True)
+ # Run the command line with the given environment in the execution directory.
+ commandLine = (pipes.quote(x) for x in remaining)
+ return subprocess.call(' '.join(commandLine), cwd=args.execdir, env=env, shell=True)
finally:
shutil.rmtree(args.execdir)
diff --git a/libcxx/utils/ssh.py b/libcxx/utils/ssh.py
index c7d8c97a1407..f9bcabe3c321 100644
--- a/libcxx/utils/ssh.py
+++ b/libcxx/utils/ssh.py
@@ -15,6 +15,7 @@
import argparse
import os
+import pipes
import posixpath
import subprocess
import sys
@@ -97,10 +98,11 @@ def main():
# host by transforming the path of test-executables to their path in the
# temporary directory, where we know they have been copied when we handled
# test dependencies above.
+ commandLine = (pathOnRemote(x) if isTestExe(x) else x for x in commandLine)
remoteCommands += [
'cd {}'.format(tmp),
'export {}'.format(' '.join(args.env)),
- ' '.join(pathOnRemote(x) if isTestExe(x) else x for x in commandLine)
+ ' '.join(pipes.quote(x) for x in commandLine)
]
# Finally, SSH to the remote host and execute all the commands.
_______________________________________________
libcxx-commits mailing list
libcxx-commits at lists.llvm.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=Hl9-ZiiL2yqSV5HmNTc7zfpLxwe0WQzYs5zejcFrQDk&s=Y792m9ysaDPcil_LdYIBYPsxwxtajWExJC4SwpvumZw&e=
More information about the libcxx-commits
mailing list