[elbe-devel] [PATCH 4/8] elbepack: imgutils: switch to non-shell syntax

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed May 15 13:32:20 CEST 2024


The shell syntax is error-prone and a mess of nested quoting syntax.

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

diff --git a/elbepack/imgutils.py b/elbepack/imgutils.py
index 4a8c5f57c151..c7182d733be0 100644
--- a/elbepack/imgutils.py
+++ b/elbepack/imgutils.py
@@ -11,13 +11,13 @@ from elbepack.shellhelper import do, get_command_out
 @contextlib.contextmanager
 def losetup(dev, extra_args=[]):
     loopdev = get_command_out(
-        f'losetup --find --show --partscan {" ".join(extra_args)} "{dev}"'
+        ['losetup', '--find', '--show', '--partscan', *extra_args, dev]
     ).decode('ascii').rstrip('\n')
 
     try:
         yield loopdev
     finally:
-        do(f'losetup --detach {loopdev}', check=False)
+        do(['losetup', '--detach', loopdev], check=False)
 
 
 class _Mount:

-- 
2.45.0



More information about the elbe-devel mailing list