[elbe-devel] [PATCH 3/7] elbepack: elbeproject: switch chroot() calls to non-shell

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Apr 30 09:23:10 CEST 2024


Running commands through a shell is error-prone.
Migrate all shell-based invocations to normal ones.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/elbeproject.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index a446907d3f61..cb400f26a5b4 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -289,7 +289,7 @@ class ElbeProject:
         sysrootfilelist = os.path.join(self.builddir, 'sysroot-filelist')
 
         with self.sysrootenv.rfs:
-            chroot(self.sysrootpath, '/usr/bin/symlinks -cr /usr/lib')
+            chroot(self.sysrootpath, ['/usr/bin/symlinks', '-cr', '/usr/lib'])
 
         paths = self.get_sysroot_paths()
 
@@ -427,11 +427,11 @@ class ElbeProject:
         elif p.tag == 'svn':
             do(f'svn co --non-interactive {src_uri} {src_path}')
         elif p.tag == 'src-pkg':
-            apt_args = '--yes -q --download-only'
+            apt_args = ['--yes', '-q', '--download-only']
             if self.xml.prj.has('noauth'):
-                apt_args += ' --allow-unauthenticated'
-            chroot(self.chrootpath, '/usr/bin/apt-get update')
-            chroot(self.chrootpath, f'/usr/bin/apt-get source {apt_args} "{src_uri}"')
+                apt_args.append('--allow-unauthenticated')
+            chroot(self.chrootpath, ['/usr/bin/apt-get', 'update'])
+            chroot(self.chrootpath, ['/usr/bin/apt-get', 'source', *apt_args, src_uri])
 
             do(f'dpkg-source -x {self.chrootpath}/*.dsc "{src_path}"; rm {self.chrootpath}/*.dsc')
         else:

-- 
2.44.0



More information about the elbe-devel mailing list