From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lfhbe-0000cm-8D for qemu-devel@nongnu.org; Fri, 06 Mar 2009 16:29:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lfhbc-0000cV-O6 for qemu-devel@nongnu.org; Fri, 06 Mar 2009 16:29:21 -0500 Received: from [199.232.76.173] (port=49731 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lfhbc-0000cQ-GU for qemu-devel@nongnu.org; Fri, 06 Mar 2009 16:29:20 -0500 Received: from mx2.redhat.com ([66.187.237.31]:53376) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lfhbc-0007gj-4r for qemu-devel@nongnu.org; Fri, 06 Mar 2009 16:29:20 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n26LTGHF009339 for ; Fri, 6 Mar 2009 16:29:18 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n26LTGBY014432 for ; Fri, 6 Mar 2009 16:29:17 -0500 Received: from blackpad.localdomain (vpn-10-15.bos.redhat.com [10.16.10.15]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n26LTGQF016439 for ; Fri, 6 Mar 2009 16:29:16 -0500 Date: Fri, 6 Mar 2009 18:28:30 -0300 From: Eduardo Habkost Message-ID: <20090306212830.GL5077@blackpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH][RFC] Handling ':' on filenames Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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