From 47da2084b5b6c834648666ccd1faf79a0e3a61f4 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Fri, 30 Jun 2023 13:25:09 +0200 Subject: bin/debvm-run: commas in the image filename must be escaped --- bin/debvm-run | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3