diff options
Diffstat (limited to 'bin/debvm-run')
-rwxr-xr-x | bin/debvm-run | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index bba0c15..1b45a33 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -348,9 +348,14 @@ set -- \ -initrd "/proc/self/fd/$INITRDFD" \ "$@" +# If the image filename contains a comma, then that comma must be escaped by +# prefixing it with another comma or otherwise output filenames are able to +# inject drive options to qemu (and load the wrong file). +IMAGE_ESCAPED="$(printf "%s" "$IMAGE" | sed 's/,/,,/g')" + if ! check_skip root/dev; then set -- \ - -drive "media=disk,format=raw,discard=unmap,file=$IMAGE,if=virtio,cache=unsafe" \ + -drive "media=disk,format=raw,discard=unmap,file=$IMAGE_ESCAPED,if=virtio,cache=unsafe" \ "$@" fi @@ -456,7 +461,7 @@ if test -z "$GRAPHICAL"; then KERNEL_CMDLINE="${KERNEL_CMDLINE:+"$KERNEL_CMDLINE "}console=ttyS0" ;; esac - if test -t 0 && test -t 1 && test -n "$TERM"; then + if test -t 0 && test -t 1 && test -n "${TERM:-}"; then KERNEL_CMDLINE="${KERNEL_CMDLINE:+"$KERNEL_CMDLINE "}TERM=$TERM" fi else |