From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>
Subject: [Qemu-devel] [PATCH v2 0/3] block: Fix backing paths for filenames with colons
Date: Mon, 22 May 2017 21:52:14 +0200 [thread overview]
Message-ID: <20170522195217.12991-1-mreitz@redhat.com> (raw)
There are (at least) two issues with filenames that contain colons when
trying to use relative backing filenames with them, for each of which
there is a patch in this series.
The first patch fixes an issue in the general block layer
(path_combine() does not have the same opinion on what constitutes a
protocol prefix as path_has_protocl()), the second fixes an issue in
file-* (when stripping off the optional "file:" prefix we should not
create a filename that seems to have another valid protocol prefix).
The third patch adds a test.
Bonus info: The following is something I did not change, although it is
weird:
$ mkdir foo && cd foo
$ ../qemu-img create -f qcow2 file:image:base.qcow2 64M
Formatting 'file:image:base.qcow2', fmt=qcow2 size=67108864
encryption=off cluster_size=65536 lazy_refcounts=off
refcount_bits=16
$ ../qemu-img create -f qcow2 -b file:image:base.qcow2 file:image:top.qcow2
Formatting 'file:image:top.qcow2', fmt=qcow2 size=67108864
backing_file=file:image:base.qcow2 encryption=off
cluster_size=65536 lazy_refcounts=off refcount_bits=16
$ cd ..
$ ./qemu-img info foo/image:top.qcow2
image: foo/image:top.qcow2
file format: qcow2
virtual size: 64M (67108864 bytes)
disk size: 196K
cluster_size: 65536
backing file: file:image:base.qcow2
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
$ ./qemu-io foo/image:top.qcow2
can't open device foo/image:top.qcow2: Could not open backing file:
Could not open './image:base.qcow2': No such file or directory
Patch 3 adds a comment to the test which explains this behavior in a bit
more detail, but the gist is this: qemu generally thinks that
protocol-prefixed filenames are absolute filenames; but from a
file-posix perspective, "file:foo" is still a relative filename.
I think the above behavior is what we want and that it's the best we can
do, but it still is weird, so I just wanted to mention it.
v2:
- Kept patch 1 unchanged
- Added patch 2
- Extended patch 3 (did NOT change the patch title)
git-backport-diff against v2:
Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/3:[----] [--] 'block: Fix backing paths for filenames with colons'
002/3:[down] 'block/file-*: *_parse_filename() and colons'
003/3:[0036] [FC] 'iotests: Add test for colon handling'
Max Reitz (3):
block: Fix backing paths for filenames with colons
block/file-*: *_parse_filename() and colons
iotests: Add test for colon handling
include/block/block_int.h | 3 ++
block.c | 50 ++++++++++++++++++---
block/file-posix.c | 17 ++------
block/file-win32.c | 12 +-----
tests/qemu-iotests/126 | 105 +++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/126.out | 23 ++++++++++
tests/qemu-iotests/group | 1 +
7 files changed, 182 insertions(+), 29 deletions(-)
create mode 100755 tests/qemu-iotests/126
create mode 100644 tests/qemu-iotests/126.out
--
2.9.4
next reply other threads:[~2017-05-22 19:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 19:52 Max Reitz [this message]
2017-05-22 19:52 ` [Qemu-devel] [PATCH v2 1/3] block: Fix backing paths for filenames with colons Max Reitz
2017-05-22 19:52 ` [Qemu-devel] [PATCH v2 2/3] block/file-*: *_parse_filename() and colons Max Reitz
2017-05-22 20:02 ` Eric Blake
2017-05-22 19:52 ` [Qemu-devel] [PATCH v2 3/3] iotests: Add test for colon handling Max Reitz
2017-05-22 20:06 ` Eric Blake
2017-05-22 20:17 ` Max Reitz
2017-05-26 17:30 ` [Qemu-devel] [PATCH v2 0/3] block: Fix backing paths for filenames with colons Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170522195217.12991-1-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).