diff mbox series

scripts/oe-publish-sdk: Convert string subprocess parameters to list

Message ID 20260706100210.677278-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit f29e2b8a72ecb47b3edd5ed462e33e4d29f0819e
Headers show
Series scripts/oe-publish-sdk: Convert string subprocess parameters to list | expand

Commit Message

Richard Purdie July 6, 2026, 10:02 a.m. UTC
Convert string subprocess commands to lists and drop the shell=True. We
can drop the sh indirection in one case too.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 scripts/oe-publish-sdk | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/scripts/oe-publish-sdk b/scripts/oe-publish-sdk
index b8a652e47f5..e24446ce1bf 100755
--- a/scripts/oe-publish-sdk
+++ b/scripts/oe-publish-sdk
@@ -60,8 +60,8 @@  def publish(args):
     if not is_remote:
         mkdir(destination)
     else:
-        cmd = "ssh %s 'mkdir -p %s'" % (host, destdir)
-        ret = subprocess.call(cmd, shell=True)
+        cmd = ['ssh', host, 'mkdir -p %s' % destdir]
+        ret = subprocess.call(cmd)
         if ret != 0:
             logger.error("Making directory %s on %s failed" % (destdir, host))
             return ret
@@ -76,8 +76,8 @@  def publish(args):
         else:
             shutil.copy(target_sdk, dest_sdk)
     else:
-        cmd = "scp %s %s" % (target_sdk, destination)
-        ret = subprocess.call(cmd, shell=True)
+        cmd = ['scp', target_sdk, destination]
+        ret = subprocess.call(cmd)
         if ret != 0:
             logger.error("scp %s %s failed" % (target_sdk, destination))
             return ret
@@ -85,8 +85,8 @@  def publish(args):
     # Unpack the SDK
     logger.info("Unpacking SDK")
     if not is_remote:
-        cmd = "sh %s -p -y -d %s" % (dest_sdk, destination)
-        ret = subprocess.call(cmd, shell=True)
+        cmd = [dest_sdk, '-p', '-y', '-d', destination]
+        ret = subprocess.call(cmd)
         if ret == 0:
             logger.info('Successfully unpacked %s to %s' % (dest_sdk, destination))
             os.remove(dest_sdk)
@@ -97,8 +97,8 @@  def publish(args):
         rm_or_not = " && rm -f %s" % dest_sdk
         if args.keep_orig:
             rm_or_not = ""
-        cmd = "ssh %s 'sh %s -p -y -d %s%s'" % (host, dest_sdk, destdir, rm_or_not)
-        ret = subprocess.call(cmd, shell=True)
+        cmd = ['ssh', host, 'sh %s -p -y -d %s%s' % (dest_sdk, destdir, rm_or_not)]
+        ret = subprocess.call(cmd)
         if ret == 0:
             logger.info('Successfully unpacked %s to %s' % (dest_sdk, destdir))
         else: