From 343abb2d7a1dcc8be7dc831fa80dd5e280eb0be7 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Mon, 21 Oct 2024 10:18:11 +0200 Subject: [PATCH] driver/usbstoragedriver: wrap commands Use the wrap_command() function to escape command arguments in case a remote operation over SSH is done. Fixes #1392 Alternative to #1450 Signed-off-by: Rouven Czerwinski --- labgrid/driver/usbstoragedriver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/labgrid/driver/usbstoragedriver.py b/labgrid/driver/usbstoragedriver.py index 5ceec293d..87c75cbca 100644 --- a/labgrid/driver/usbstoragedriver.py +++ b/labgrid/driver/usbstoragedriver.py @@ -113,7 +113,7 @@ def write_files(self, sources, target, partition, target_is_directory=True): args = ["cp", "-T", copied_sources[0], target_path] - processwrapper.check_output(self.storage.command_prefix + args) + processwrapper.check_output(self.storage.wrap_command(args)) self.proxy.unmount(self.devpath) except: # We are going to die with an exception anyway, so no point in waiting @@ -231,7 +231,7 @@ def get_size(self, partition=None): """ args = ["cat", f"/sys/class/block/{self._get_devpath(partition)[5:]}/size"] try: - size = subprocess.check_output(self.storage.command_prefix + args) + size = subprocess.check_output(self.storage.wrap_command(args)) except subprocess.CalledProcessError: # while the medium is getting ready, the file does not yet exist return 0