From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrEr5-00051f-PI for qemu-devel@nongnu.org; Thu, 12 Dec 2013 17:35:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrEr0-0005So-QE for qemu-devel@nongnu.org; Thu, 12 Dec 2013 17:35:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrEr0-0005Sj-A9 for qemu-devel@nongnu.org; Thu, 12 Dec 2013 17:35:34 -0500 Message-ID: <52AA3A2F.9040008@redhat.com> Date: Thu, 12 Dec 2013 15:35:27 -0700 From: Eric Blake MIME-Version: 1.0 References: <1386657774-9342-1-git-send-email-gesaint@linux.vnet.ibm.com> In-Reply-To: <1386657774-9342-1-git-send-email-gesaint@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="T0jvKnCFbT8Mt38HBxLtgH53maI0I424t" Subject: Re: [Qemu-devel] [PATCH] block: Fix relative backing file path checking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xu Wang , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --T0jvKnCFbT8Mt38HBxLtgH53maI0I424t Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/09/2013 11:42 PM, Xu Wang wrote: > This patch is made for Bug #1257334 (diffuse handling of image > creation from another path). The cause of it is user could create > image even though the backing file doesn't exist. Becase backing s/Becase/, because/ > file checking in the bdrv_img_create() is from the user's current > path instead of relative path to the image to be created. This patch > makes qemu check backing file according to the relative path to the > image to be created. Hence if relative backing file path doesn't > exist, the backing file checking will fail now. >=20 > Test case: > Reproduce process (from bug page): > 1. $mkdir a/ > 2. $qemu-img create -f qcow2 a/blob.img 10G > 3. $qemu-img create -f qcow2 -b a/blob.img a/ovl.img > Here the actual backing file of ovl.img is a/a/blob.img. But > the backing file checking will check from the user's current > path and find a/blob.img successfully. But the path saved in > the ovl.img is a/a/blob.img. Bug occurred. >=20 > After patched: > The step 3 above an error message will be thrown because backing > file checking started after got the full path of backing file > intead of relative path. s/intead/instead/ >=20 > Signed-off-by: Xu Wang > --- > block.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) >=20 > diff --git a/block.c b/block.c > index 13f001a..20d2b66 100644 > --- a/block.c > +++ b/block.c > @@ -4790,18 +4790,31 @@ void bdrv_img_create(const char *filename, cons= t char *fmt, > uint64_t size; > char buf[32]; > int back_flags; > + char backing_filename_full[PATH_MAX]; I hate code that uses PATH_MAX as an array size. It is not portable to systems like GNU Hurd. But qemu doesn't compile on GNU Hurd, and you're not the first user of this construct in the codebase (so the problem already exists and should be independently cleaned up). So I won't let it hold up your patch. > + error_setg_errno(errp, -ret, "Backing file '%s'" > + "(actual path is '%s') error: %s", Outputs "Backing file 'foo'(actual path...", which looks bad. You need a space in the error message either before or after the line break. The rest of the patch looks okay. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --T0jvKnCFbT8Mt38HBxLtgH53maI0I424t Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSqjovAAoJEKeha0olJ0NqXnUH/1Y/d8GA3hn+Awo/+xGARYD6 5xesPGVO0tTPRDxaSWZXfoehJnRIXRsnMfn3lgYsb058n8aNx31IiAVxTMj58KRo z2r8EhI1hjVABAeq44JgRO60EX068DtgASuBZDB+/IfV1HN7G7SOxSe0W3B+luik VIoeTltG9YTKyT6l+GEMEoCm3fw2m3+pq2oCcDBW7wPmA+oZhQGcUs2mpaYL+JaV YrrH47UXB5QBTB8YwRr8mdSjRIP1hVCZ4nBlMd6gdk+HCHTiHlOPGoIQRElJ3Ifa hGBks4cHcz6LgcCK0kiUznX256f/hnDI+9T5Bf7ST63hE/yc3xDvGhOYM/M6dUw= =sA23 -----END PGP SIGNATURE----- --T0jvKnCFbT8Mt38HBxLtgH53maI0I424t--