Control: retitle -1 autopkgtest-virt-qemu: no way to pass qemu options that 
contain whitespace
Control: severity -1 wishlist

On Wed, 30 Apr 2025 at 16:40:59 +0200, Isaac True wrote:
the value passed to "--qemu-option" is cut up into individual arguments using the Python 
function split() ("qemu_options=args.qemu_options.split()" in autopkgtest-virt-qemu). 
This causes the quoted section to be ignored

This appears to be working as designed, although the design does not accommodate your use-case. None of the documentation mentions anything about ability to use quoting or escaping in --qemu-option, and the --help specifies that it's whitespace-separated:

  --qemu-options QEMU_OPTIONS
                        Pass through (whitespace-separated) arguments to
                        QEMU command.

(The man page does not currently include that clarification.)

If we changed this to some more elaborate parser that interprets quotes or backslash escapes (such as shlex.split()), that would change the meaning of existing a-v-qemu command-lines, breaking backward compatibility, which seems like a bad idea. A new option (--qemu-options-shlex?) could have that behaviour, though.

Or, a-v-qemu could gain explicit --kernel, --initrd, --append options which would turn your use-case into something like:

    autopkgtest ... -- qemu --append="init=... and so on" --kernel="..." 
--initrd="..." maindisk.qcow2

(Or both.)

A workaround could be to have a script with something like

    #!/bin/sh
    exec qemu-system-aarch64 -append "init=... and so on" -kernel "..." -initrd "..." 
"$@"

and pass the name of that script as the --qemu-command, which is likely to be more ergonomic anyway if this is something that you are running repeatedly.

    smcv

Reply via email to