qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH][RFC] Handling ':' on filenames
@ 2009-03-06 21:28 Eduardo Habkost
  2009-03-08 11:28 ` Uri Lublin
  0 siblings, 1 reply; 8+ messages in thread
From: Eduardo Habkost @ 2009-03-06 21:28 UTC (permalink / raw)
  To: qemu-devel


This patch fixes this issue:

  $ qemu-img create -f qcow2 /tmp/a:b 1G
  $ qemu-system-x86_64 -hda qcow2:/tmp/a:b
  qemu: could not open disk image /tmp/a:b
  $

Based on a suggestion by Daniel Berrange.

However, this is still just a workaround. The semantics of filenames
containing colon characters (and how this can be escaped, avoided,
or worked around) are not very clear.

Going further, what if we stop using "protocol:filename" strings
internally, except where the user interface or external data really
requires this format?

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 block.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index 7c744c7..04488d6 100644
--- a/block.c
+++ b/block.c
@@ -236,6 +236,14 @@ static BlockDriver *find_protocol(const char *filename)
         is_windows_drive_prefix(filename))
         return &bdrv_raw;
 #endif
+
+    /* Protocol name will never start with a slash.
+     * This allows the user to specify absolute filenames
+     * containing a ":" character.
+     */
+    if (*filename == '/')
+        return &bdrv_raw;
+
     p = strchr(filename, ':');
     if (!p)
         return &bdrv_raw;
-- 
1.6.1

-- 
Eduardo

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

end of thread, other threads:[~2009-03-10  3:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06 21:28 [Qemu-devel] [PATCH][RFC] Handling ':' on filenames Eduardo Habkost
2009-03-08 11:28 ` Uri Lublin
2009-03-08 11:49   ` Stuart Brady
2009-03-09 14:32     ` Eduardo Habkost
2009-03-09 21:11       ` Jamie Lokier
2009-03-09 14:21   ` Eduardo Habkost
2009-03-09 14:27   ` Eduardo Habkost
2009-03-10  3:59     ` Amit Shah

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