]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
scripts: fix logic error in argv wrapping code
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 17 Sep 2020 11:49:12 +0000 (12:49 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 18 Sep 2020 10:22:07 +0000 (11:22 +0100)
The first piece of the command we process must be added to the list
straight away regardless of whether it starts with a '-' or not.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
scripts/test-wrap-argv.py

index 4193e6b68d29d84afa97f3658f273fc6e7ddb587..6b0d3511f3bd108a7a3759c85e515baf28adddb7 100755 (executable)
@@ -59,7 +59,7 @@ def rewrap_line(line):
             # If there's a leading '-' then this is a new
             # parameter, otherwise its a value for the prev
             # parameter.
-            if bit.startswith("-"):
+            if bit.startswith("-") or len(args) == 0:
                 args.append(bit)
             else:
                 args[-1] = args[-1] + " " + bit