qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/3] block: Fix backing paths for filenames with colons
@ 2017-05-22 19:52 Max Reitz
  2017-05-22 19:52 ` [Qemu-devel] [PATCH v2 1/3] " Max Reitz
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Max Reitz @ 2017-05-22 19:52 UTC (permalink / raw)
  To: qemu-block; +Cc: qemu-devel, Max Reitz, Kevin Wolf, Eric Blake

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-26 17:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 19:52 [Qemu-devel] [PATCH v2 0/3] block: Fix backing paths for filenames with colons Max Reitz
2017-05-22 19:52 ` [Qemu-devel] [PATCH v2 1/3] " 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

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).