diff options
author | Helmut Grohne <helmutg@debian.org> | 2023-07-06 06:14:20 +0000 |
---|---|---|
committer | Helmut Grohne <helmutg@debian.org> | 2023-07-06 06:14:20 +0000 |
commit | bef9c51e23f9491c724d621025caa654bb498107 (patch) | |
tree | eb8796fbef07376bcd49eb16f5005ea5689b88ba | |
parent | b7227a23694cbdd8c8e8c4c81f07f98bfaf7d99d (diff) | |
parent | 47da2084b5b6c834648666ccd1faf79a0e3a61f4 (diff) | |
download | debvm-bef9c51e23f9491c724d621025caa654bb498107.tar.gz |
Merge branch 'commas' into 'main'
bin/debvm-run: if the image filename contains a comma, then that comma must be...
See merge request helmutg/debvm!35
-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 |