qemu/include
Max Reitz 03c320d803 block/file-*: *_parse_filename() and colons
The file drivers' *_parse_filename() implementations just strip the
optional protocol prefix off the filename. However, for e.g.
"file:foo:bar", this would lead to "foo:bar" being stored as the BDS's
filename which looks like it should be managed using the "foo" protocol.
This is especially troublesome if you then try to resolve a backing
filename based on "foo:bar".

This issue can only occur if the stripped part is a relative filename
("file:/foo:bar" will be shortened to "/foo:bar" and having a slash
before the first colon means that "/foo" is not recognized as a protocol
part). Therefore, we can easily fix it by prepending "./" to such
filenames.

Before this patch:
$ ./qemu-img create -f qcow2 backing.qcow2 64M
Formatting 'backing.qcow2', fmt=qcow2 size=67108864 encryption=off
    cluster_size=65536 lazy_refcounts=off refcount_bits=16
$ ./qemu-img create -f qcow2 -b backing.qcow2 file🔝image.qcow2
Formatting 'file🔝image.qcow2', fmt=qcow2 size=67108864
    backing_file=backing.qcow2 encryption=off cluster_size=65536
    lazy_refcounts=off refcount_bits=16
$ ./qemu-io file🔝image.qcow2
can't open device file🔝image.qcow2: Could not open backing file:
    Unknown protocol 'top'

After this patch:
$ ./qemu-io file🔝image.qcow2
[no error]

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20170522195217.12991-3-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-05-29 15:39:54 +02:00
..
block block/file-*: *_parse_filename() and colons 2017-05-29 15:39:54 +02:00
crypto crypto: qcrypto_random_bytes() now works on windows w/o any other crypto libs 2017-05-09 14:41:47 +01:00
disas
exec migration: Make savevm.c target independent 2017-05-18 19:21:00 +02:00
fpu
hw audio: move & rename soundhw init code. 2017-05-19 16:54:14 +01:00
io trivial patches for 2017-05-10 2017-05-10 12:31:19 -04:00
libdecnumber
migration migration: Remove vmstate.h from migration.h 2017-05-18 19:20:59 +02:00
monitor
net slirp: add a fake NC-SI backend 2017-04-25 19:17:25 +08:00
qapi qapi: Document intended use of @name within alternate visits 2017-05-09 09:14:40 +02:00
qemu migration: Remove old MigrationParams 2017-05-18 18:04:54 +02:00
qom spapr: add node-id property to sPAPR core 2017-05-11 16:08:48 -03:00
standard-headers
sysemu audio: move & rename soundhw init code. 2017-05-19 16:54:14 +01:00
ui opengl: add egl-headless display 2017-05-12 12:02:48 +02:00
elf.h
glib-compat.h qga: Add 'guest-get-users' command 2017-04-26 23:57:45 -05:00
qemu-common.h utils: provide size_to_str() 2017-05-17 17:30:45 +01:00
qemu-io.h
trace-tcg.h