From 50b5fef06cdd22657550afbe3f99323ac548b314 Mon Sep 17 00:00:00 2001
From: Matthieu Imbert <matthieu.imbert@inria.fr>
Date: Thu, 4 Apr 2024 13:56:51 +0200
Subject: [PATCH] [execo] Get, Put: scp command as list and shell=False to
 (securely) handle spaces in path

---
 src/execo/action.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/execo/action.py b/src/execo/action.py
index 3ac684f..1a17db2 100644
--- a/src/execo/action.py
+++ b/src/execo/action.py
@@ -997,9 +997,7 @@ class Put(Remote):
             processlh = ActionNotificationProcessLH(self, len(self.hosts))
             for (index, host) in enumerate(self.hosts):
                 real_command = list(get_scp_command(host.user, host.keyfile, host.port, self.connection_params)) + [ remote_substitute(local_file, self.hosts, index, self._caller_context) for local_file in self.local_files ] + ["%s:%s" % (get_rewritten_host_address(host.address, self.connection_params), remote_substitute(self.remote_location, self.hosts, index, self._caller_context)),]
-                real_command = ' '.join(real_command)
                 p = Process(real_command)
-                p.shell = True
                 p.lifecycle_handlers.append(processlh)
                 p.host = host
                 self.processes.append(p)
@@ -1061,9 +1059,7 @@ class Get(Remote):
                 for path in self.remote_files:
                     remote_specs += ("%s:%s" % (get_rewritten_host_address(host.address, self.connection_params), remote_substitute(path, self.hosts, index, self._caller_context)),)
                 real_command = get_scp_command(host.user, host.keyfile, host.port, self.connection_params) + remote_specs + (remote_substitute(self.local_location, self.hosts, index, self._caller_context),)
-                real_command = ' '.join(real_command)
                 p = Process(real_command)
-                p.shell = True
                 p.lifecycle_handlers.append(processlh)
                 p.host = host
                 self.processes.append(p)
-- 
GitLab