[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
Thu Mar 25 00:54:07 PDT 2021


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb8b23aa80eef: [libcxx] [test] Quote env variables that are set with a shell "export" in ssh.py (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D99242?vs=333120&id=333229#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99242/new/

https://reviews.llvm.org/D99242

Files:
  libcxx/utils/ssh.py


Index: libcxx/utils/ssh.py
===================================================================
--- libcxx/utils/ssh.py
+++ libcxx/utils/ssh.py
@@ -23,6 +23,12 @@
 import tarfile
 import tempfile
 
+try:
+   from shlex import quote as cmd_quote
+except ImportError:
+   # for Python 2 compatibility
+   from pipes import quote as cmd_quote
+
 def ssh(args, command):
     cmd = ['ssh', '-oBatchMode=yes']
     if args.extra_ssh_args is not None:
@@ -107,7 +113,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(cmd_quote(' '.join(args.env))))
         remoteCommands.append(subprocess.list2cmdline(commandLine))
 
         # Finally, SSH to the remote host and execute all the commands.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99242.333229.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210325/6236c719/attachment.bin>


More information about the libcxx-commits mailing list