[PATCH] D65960: Fix environment variable passing in libc++'s `SSHExecutor` `lit` utility

Bryce Adelstein Lelbach via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 10:21:16 PDT 2019


wash created this revision.
wash added reviewers: ldionne, EricWF, mclow.lists.
wash added projects: LLVM, libc++.
Herald added subscribers: llvm-commits, dexonsmith, christof, kristof.beyls, javed.absar.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D65960

Files:
  libcxx/utils/libcxx/test/executor.py


Index: libcxx/utils/libcxx/test/executor.py
===================================================================
--- libcxx/utils/libcxx/test/executor.py
+++ libcxx/utils/libcxx/test/executor.py
@@ -187,7 +187,7 @@
         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()]
         else:
             env_cmd = []
         remote_cmd = ' '.join(env_cmd + cmd)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65960.214179.patch
Type: text/x-patch
Size: 584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190808/7b6eaccf/attachment.bin>


More information about the llvm-commits mailing list