[libcxx-commits] [PATCH] D99242: [libcxx] [test] Quote env variables that are set with a shell "export" in ssh.py

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 24 00:48:33 PDT 2021

mstorsjo created this revision.
Herald added a subscriber: arichardson.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

This safeguards against cases if some of the env vars contain chars
that are problematic for shells.

  rG LLVM Github Monorepo



Index: libcxx/utils/ssh.py
--- libcxx/utils/ssh.py
+++ libcxx/utils/ssh.py
@@ -16,6 +16,7 @@
 import argparse
 import os
+import pipes
 import posixpath
 import shlex
 import subprocess
@@ -107,7 +108,7 @@
         commandLine = (pathOnRemote(x) if isTestExe(x) else x for x in commandLine)
         remoteCommands.append('cd {}'.format(tmp))
         if args.env:
-            remoteCommands.append('export {}'.format(' '.join(args.env)))
+            remoteCommands.append('export {}'.format(pipes.quote(' '.join(args.env))))
         # Finally, SSH to the remote host and execute all the commands.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99242.332882.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210324/4fef910e/attachment-0001.bin>

More information about the libcxx-commits mailing list