diff options
-rwxr-xr-x | bin/debvm-run | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index 044cec0..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 |