Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Kevin Wolf
Am 11.04.2012 19:29, schrieb Jeff Cody: When block streaming an image, if a base name is passed in that is a relative name, but not accessible from the top-level snapshot, then the relative name is stored incorrectly in the image file. For instance, given a snapshot case of:

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Eric Blake
On 04/12/2012 02:50 AM, Kevin Wolf wrote: + +src = realpath(current, NULL); My POSIX manpage says: If resolved_name is a null pointer, the behavior of realpath() is implementation-defined. It seems to have been standardised by now, but I'm not sure if it is a good idea to rely on

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Paolo Bonzini
Il 12/04/2012 14:10, Eric Blake ha scritto: Worse, there are known compliance bugs; realpath() on Solaris 10 will return a relative answer for relative input, for example. I don't know if glib provides a more portable alternative function, but I'd start by searching that. No, it doesn't. I

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Daniel P. Berrange
On Thu, Apr 12, 2012 at 02:13:18PM +0200, Paolo Bonzini wrote: Il 12/04/2012 14:10, Eric Blake ha scritto: Worse, there are known compliance bugs; realpath() on Solaris 10 will return a relative answer for relative input, for example. I don't know if glib provides a more portable

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Jeff Cody
On 04/12/2012 04:50 AM, Kevin Wolf wrote: Am 11.04.2012 19:29, schrieb Jeff Cody: When block streaming an image, if a base name is passed in that is a relative name, but not accessible from the top-level snapshot, then the relative name is stored incorrectly in the image file. For instance,

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Kevin Wolf
Am 12.04.2012 15:17, schrieb Jeff Cody: + * + * Returns NULL if no relative or absolute path can be found. + */ +static char *path_find_relative(char *current, char *backing) +{ +char *src; +char *dest; +char *src_tmp; +char *src_dir; +char *rel_backing = NULL; +

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Paolo Bonzini
Il 12/04/2012 15:41, Kevin Wolf ha scritto: As the comments pointed out by Eric and Paolo indicate, the issue is worse on some platforms. It would be nice to be able to rely on canonicalize_file_name(), so I like Daniel's suggestion of pulling in Paolo's proposed glib patch into QEMU.

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Jeff Cody
On 04/12/2012 09:41 AM, Kevin Wolf wrote: Am 12.04.2012 15:17, schrieb Jeff Cody: + * + * Returns NULL if no relative or absolute path can be found. + */ +static char *path_find_relative(char *current, char *backing) +{ +char *src; +char *dest; +char *src_tmp; +char

Re: [Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-12 Thread Kevin Wolf
Am 12.04.2012 16:12, schrieb Paolo Bonzini: Il 12/04/2012 15:41, Kevin Wolf ha scritto: As the comments pointed out by Eric and Paolo indicate, the issue is worse on some platforms. It would be nice to be able to rely on canonicalize_file_name(), so I like Daniel's suggestion of pulling in

[Qemu-devel] [RFC PATCH] block: for a streaming job, fix relative base name arguments

2012-04-11 Thread Jeff Cody
When block streaming an image, if a base name is passed in that is a relative name, but not accessible from the top-level snapshot, then the relative name is stored incorrectly in the image file. For instance, given a snapshot case of: /tmp/a/base.raw /tmp/a/snap1.qcow2 /tmp/b/snap2.qcow2 if