[libcxx-commits] [libcxx] r368317 - [libc++] Fix environment variable passing in libc++'s `SSHExecutor` `lit` utility

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 8 10:33:35 PDT 2019

Author: ldionne
Date: Thu Aug  8 10:33:35 2019
New Revision: 368317

URL: http://llvm.org/viewvc/llvm-project?rev=368317&view=rev
[libc++] Fix environment variable passing in libc++'s `SSHExecutor` `lit` utility

Quote the value of environment variables when passing them to the SSH
client in SSHExecutor in libc++'s lit utilities. Without the quotes,
an environment variable like FOO="buzz bar" gets passed incorrectly
like this, ssh env FOO=buzz bar, which causes bar to be treated as a
command to run, not part of the environment variable value.

We ran into this when using SSHExecutor to do bringup of our CUDA
libcu++ port on an embedded aarch64 system.

Patch by Bryce Adelstein Lelbach.

Differential Revision: https://reviews.llvm.org/D65960


Modified: libcxx/trunk/utils/libcxx/test/executor.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/executor.py?rev=368317&r1=368316&r2=368317&view=diff
--- libcxx/trunk/utils/libcxx/test/executor.py (original)
+++ libcxx/trunk/utils/libcxx/test/executor.py Thu Aug  8 10:33:35 2019
@@ -187,7 +187,7 @@ class SSHExecutor(RemoteExecutor):
         remote = self.user_prefix + self.host
         ssh_cmd = [self.ssh_command, '-oBatchMode=yes', remote]
         if env:
-            env_cmd = ['env'] + ['%s=%s' % (k, v) for k, v in env.items()]
+            env_cmd = ['env'] + ['%s="%s"' % (k, v) for k, v in env.items()]
             env_cmd = []
         remote_cmd = ' '.join(env_cmd + cmd)

More information about the libcxx-commits mailing list