All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files
@ 2011-08-14 16:32 Steve Si
  2011-08-14 21:25 ` [Qemu-devel] [Bug 826363] " Steve Si
                   ` (13 more replies)
  0 siblings, 14 replies; 25+ messages in thread
From: Steve Si @ 2011-08-14 16:32 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

qemu-img.exe convert -O raw  myfile.vdi zz.raw

reports 'error while writing' both in 0.15.0 and Beta rc2
v0.11.1 works file on same file. myfile.vdi is 3.9GB made by VirtualBox.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works file on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
@ 2011-08-14 21:25 ` Steve Si
  2011-08-15 21:12 ` [Qemu-devel] [Bug 826363] [NEW] " Stefan Hajnoczi
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Steve Si @ 2011-08-14 21:25 UTC (permalink / raw)
  To: qemu-devel

** Description changed:

  qemu-img.exe convert -O raw  myfile.vdi zz.raw
  
  reports 'error while writing' both in 0.15.0 and Beta rc2
- v0.11.1 works file on same file. myfile.vdi is 3.9GB made by VirtualBox.
+ v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* Re: [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
  2011-08-14 21:25 ` [Qemu-devel] [Bug 826363] " Steve Si
@ 2011-08-15 21:12 ` Stefan Hajnoczi
  2011-08-15 22:59 ` [Qemu-devel] [Bug 826363] " Steve Si
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Stefan Hajnoczi @ 2011-08-15 21:12 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

On Sun, Aug 14, 2011 at 5:32 PM, Steve Si <826363@bugs.launchpad.net> wrote:
> Public bug reported:
>
> qemu-img.exe convert -O raw  myfile.vdi zz.raw
>
> reports 'error while writing' both in 0.15.0 and Beta rc2
> v0.11.1 works file on same file. myfile.vdi is 3.9GB made by VirtualBox.

Are you sure that there is enough space on the file system to write
out the converted raw image?

Please try qemu-img on a Linux host with the same file.  This way we
can be sure it's a generic bug rather than a Windows or
environment-specific problem.

Stefan

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
  2011-08-14 21:25 ` [Qemu-devel] [Bug 826363] " Steve Si
  2011-08-15 21:12 ` [Qemu-devel] [Bug 826363] [NEW] " Stefan Hajnoczi
@ 2011-08-15 22:59 ` Steve Si
  2011-08-16 13:10   ` Stefan Hajnoczi
  2011-08-16 18:07 ` Steve Si
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Steve Si @ 2011-08-15 22:59 UTC (permalink / raw)
  To: qemu-devel

Please see
http://virtuallyfun.superglobalmegacorp.com/?p=1214#comment-967

confirmed bug replicated by neozeed. Seems to be something to do with vdi's that contain 3-4GB of data.
An unpartitioned freshly created 4Gb vdi can be converted to raw OK, but an 8Gb dynamic vdi with 3.8GB of data fails.
Presumably the raw file has sparse data in?? If it has 3+GB of real data then 0.15.0 errors but 0.11.1 does not??

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-15 22:59 ` [Qemu-devel] [Bug 826363] " Steve Si
@ 2011-08-16 13:10   ` Stefan Hajnoczi
  0 siblings, 0 replies; 25+ messages in thread
From: Stefan Hajnoczi @ 2011-08-16 13:10 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

On Mon, Aug 15, 2011 at 11:59 PM, Steve Si <826363@bugs.launchpad.net> wrote:
> Please see
> http://virtuallyfun.superglobalmegacorp.com/?p=1214#comment-967
>
> confirmed bug replicated by neozeed. Seems to be something to do with vdi's that contain 3-4GB of data.
> An unpartitioned freshly created 4Gb vdi can be converted to raw OK, but an 8Gb dynamic vdi with 3.8GB of data fails.
> Presumably the raw file has sparse data in?? If it has 3+GB of real data then 0.15.0 errors but 0.11.1 does not??

I created a 5 GB vdi file.  Inside it I created an ext4 file system
and a single 4 GB file with random data on that filesystem.

$ ./qemu-img info test.vdi
image: test.vdi
file format: vdi
virtual size: 5.0G (5368709120 bytes)
disk size: 4.2G
cluster_size: 1048576

The image was converted without error on qemu.git/master running on
Linux amd64.  So unfortunately I have not been able to reproduce this.

You could track down the commit which broke this using git-bisect(1).
I recommend first testing QEMU 0.14.0 to see if the bug is present
there.

The steps are:

$ git bisect start master v0.14.0  # broken on master, working on v0.14.0

Then:

$ ./configure [...] && make && qemu-img.exe [...] # check whether it errors

If qemu-img.exe completes successfully:
$ git bisect good
otherwise:
$ git bisect bad

Keep repeating this and you should end up at the commit that
introduced the bug.  If you post that it should be relatively easy to
figure out what the cause of the bug is.

Stefan

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (2 preceding siblings ...)
  2011-08-15 22:59 ` [Qemu-devel] [Bug 826363] " Steve Si
@ 2011-08-16 18:07 ` Steve Si
  2011-08-17 16:29   ` Stefan Hajnoczi
  2011-08-17 18:46 ` Steve Si
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Steve Si @ 2011-08-16 18:07 UTC (permalink / raw)
  To: qemu-devel

I got binaries from http://homepage3.nifty.com/takeda-toshiya/

tested under Win 7 64-bit as User=Administrator

qemu10.6 - works  makes      16/08/2011  18:43     3,096,481,792 test.raw
qemu11.1 - works  makes      16/08/2011  18:43     3,096,481,792 test.raw
qemu12.1 - crashes !
qemu12.2 - crashes !
qemu12.5 - error while writing
qemu13.0 - error while writing

Does this help?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-16 18:07 ` Steve Si
@ 2011-08-17 16:29   ` Stefan Hajnoczi
  2011-08-17 16:44     ` Stefan Hajnoczi
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Hajnoczi @ 2011-08-17 16:29 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

On Tue, Aug 16, 2011 at 7:07 PM, Steve Si <826363@bugs.launchpad.net> wrote:
> I got binaries from http://homepage3.nifty.com/takeda-toshiya/
>
> tested under Win 7 64-bit as User=Administrator
>
> qemu10.6 - works  makes      16/08/2011  18:43     3,096,481,792 test.raw
> qemu11.1 - works  makes      16/08/2011  18:43     3,096,481,792 test.raw
> qemu12.1 - crashes !
> qemu12.2 - crashes !
> qemu12.5 - error while writing

I think this crash->error transition is explained by:

commit 8cef921d18025b4ce4e749eed391308033fee232
Author: TeLeMan <geleman@gmail.com>
Date:   Mon Feb 8 16:20:00 2010 +0800

    qemu-img: use the heap instead of the huge stack array for win32

But we still don't know why you are getting the write error.  It would
be fairly easy to find that out by building QEMU from source and
adding fprintf() where the write fails - print out the error code and
sector number.

Stefan

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-17 16:29   ` Stefan Hajnoczi
@ 2011-08-17 16:44     ` Stefan Hajnoczi
  2011-08-20  8:50       ` Stefan Weil
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Hajnoczi @ 2011-08-17 16:44 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

On Wed, Aug 17, 2011 at 5:29 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Tue, Aug 16, 2011 at 7:07 PM, Steve Si <826363@bugs.launchpad.net> wrote:
>> I got binaries from http://homepage3.nifty.com/takeda-toshiya/
>>
>> tested under Win 7 64-bit as User=Administrator
>>
>> qemu10.6 - works  makes      16/08/2011  18:43     3,096,481,792 test.raw
>> qemu11.1 - works  makes      16/08/2011  18:43     3,096,481,792 test.raw
>> qemu12.1 - crashes !
>> qemu12.2 - crashes !
>> qemu12.5 - error while writing
>
> I think this crash->error transition is explained by:
>
> commit 8cef921d18025b4ce4e749eed391308033fee232
> Author: TeLeMan <geleman@gmail.com>
> Date:   Mon Feb 8 16:20:00 2010 +0800
>
>    qemu-img: use the heap instead of the huge stack array for win32
>
> But we still don't know why you are getting the write error.  It would
> be fairly easy to find that out by building QEMU from source and
> adding fprintf() where the write fails - print out the error code and
> sector number.

Here is a patch to print more information when the error occurs:
http://patchwork.ozlabs.org/patch/110338/

It applies onto qemu.git/master:
$ cd qemu
$ git am path/to/patch
$ ./configure [...] && make

Stefan

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (3 preceding siblings ...)
  2011-08-16 18:07 ` Steve Si
@ 2011-08-17 18:46 ` Steve Si
  2011-08-17 19:05 ` Steve Si
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Steve Si @ 2011-08-17 18:46 UTC (permalink / raw)
  To: qemu-devel

What URL can I use to do an svn checkout under MinGW?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (4 preceding siblings ...)
  2011-08-17 18:46 ` Steve Si
@ 2011-08-17 19:05 ` Steve Si
  2011-08-19  4:14   ` Stefan Hajnoczi
  2011-08-19 19:06 ` Steve Si
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Steve Si @ 2011-08-17 19:05 UTC (permalink / raw)
  To: qemu-devel

I downloaded source and ran configure under MinGW but got
Python not found. Use --python=/path/to/python
How to fix pls?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-17 19:05 ` Steve Si
@ 2011-08-19  4:14   ` Stefan Hajnoczi
  0 siblings, 0 replies; 25+ messages in thread
From: Stefan Hajnoczi @ 2011-08-19  4:14 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

On Wed, Aug 17, 2011 at 8:05 PM, Steve Si <826363@bugs.launchpad.net> wrote:
> I downloaded source and ran configure under MinGW but got
> Python not found. Use --python=/path/to/python
> How to fix pls?

$ ./configure --disable-guest-agent
$ make

Stefan

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (5 preceding siblings ...)
  2011-08-17 19:05 ` Steve Si
@ 2011-08-19 19:06 ` Steve Si
  2011-08-20 12:21 ` Stefan Weil
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Steve Si @ 2011-08-19 19:06 UTC (permalink / raw)
  To: qemu-devel

Sorry to be a pain, but now I get

$ configure --disable-guest-agent

Error: zlib check failed
Make sure to have the zlib libs and headers installed.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  New

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-17 16:44     ` Stefan Hajnoczi
@ 2011-08-20  8:50       ` Stefan Weil
  2011-08-20  8:57         ` Michael Tokarev
                           ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Stefan Weil @ 2011-08-20  8:50 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

Am 17.08.2011 18:44, schrieb Stefan Hajnoczi:
> On Wed, Aug 17, 2011 at 5:29 PM, Stefan Hajnoczi <stefanha@gmail.com> 
> wrote:
>> On Tue, Aug 16, 2011 at 7:07 PM, Steve Si <826363@bugs.launchpad.net> 
>> wrote:
>>> I got binaries from http://homepage3.nifty.com/takeda-toshiya/
>>>
>>> tested under Win 7 64-bit as User=Administrator
>>>
>>> qemu10.6 - works  makes      16/08/2011  18:43     3,096,481,792 
>>> test.raw
>>> qemu11.1 - works  makes      16/08/2011  18:43     3,096,481,792 
>>> test.raw
>>> qemu12.1 - crashes !
>>> qemu12.2 - crashes !
>>> qemu12.5 - error while writing
>>
>> I think this crash->error transition is explained by:
>>
>> commit 8cef921d18025b4ce4e749eed391308033fee232
>> Author: TeLeMan <geleman@gmail.com>
>> Date:   Mon Feb 8 16:20:00 2010 +0800
>>
>>    qemu-img: use the heap instead of the huge stack array for win32
>>
>> But we still don't know why you are getting the write error.  It would
>> be fairly easy to find that out by building QEMU from source and
>> adding fprintf() where the write fails - print out the error code and
>> sector number.

The current code only supports images (any format) with less than
4 GiB (maybe even less than 2 GiB).

This limitation is caused by the usage of function ftruncate to create
the destination file. ftruncate takes a long (32 bit) parameter.

Linux code also uses ftruncate to create files of a certain size.
This is not a good solution. Extract from the man page:

"However, some non-native file systems do not permit truncate() and
ftruncate() to be used to extend a file beyond its current length:
a notable example on Linux is VFAT."

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-20  8:50       ` Stefan Weil
@ 2011-08-20  8:57         ` Michael Tokarev
  2011-08-20 10:10         ` [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64 Stefan Weil
  2011-08-20 10:15         ` [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files Stefan Weil
  2 siblings, 0 replies; 25+ messages in thread
From: Michael Tokarev @ 2011-08-20  8:57 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel, Bug 826363

On 20.08.2011 12:50, Stefan Weil wrote:
[]
> Linux code also uses ftruncate to create files of a certain size.
> This is not a good solution. Extract from the man page:
> 
> "However, some non-native file systems do not permit truncate() and
> ftruncate() to be used to extend a file beyond its current length:
> a notable example on Linux is VFAT."

Actually it works now in VFAT too.

/mjt

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

* [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64
  2011-08-20  8:50       ` Stefan Weil
  2011-08-20  8:57         ` Michael Tokarev
@ 2011-08-20 10:10         ` Stefan Weil
  2011-08-20 12:01           ` Stefan Weil
  2011-08-22 16:32           ` Anthony Liguori
  2011-08-20 10:15         ` [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files Stefan Weil
  2 siblings, 2 replies; 25+ messages in thread
From: Stefan Weil @ 2011-08-20 10:10 UTC (permalink / raw)
  To: qemu-devel

SetFilePointer returns INVALID_SET_FILE_POINTER when it fails.
In addition, GetLastError must be checked.

The first call of SetFilePointer did not use INVALID_SET_FILE_POINTER,
the second call used wrong error handling.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 block/raw-win32.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/raw-win32.c b/block/raw-win32.c
index e47cfe0..b7dd357 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -41,6 +41,7 @@ typedef struct BDRVRawState {
 int qemu_ftruncate64(int fd, int64_t length)
 {
     LARGE_INTEGER li;
+    DWORD dw;
     LONG high;
     HANDLE h;
     BOOL res;
@@ -53,12 +54,15 @@ int qemu_ftruncate64(int fd, int64_t length)
     /* get current position, ftruncate do not change position */
     li.HighPart = 0;
     li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT);
-    if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
+    if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
 	return -1;
+    }
 
     high = length >> 32;
-    if (!SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN))
+    dw = SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN);
+    if (dw == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
 	return -1;
+    }
     res = SetEndOfFile(h);
 
     /* back to old position */
-- 
1.7.2.5

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

* Re: [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-20  8:50       ` Stefan Weil
  2011-08-20  8:57         ` Michael Tokarev
  2011-08-20 10:10         ` [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64 Stefan Weil
@ 2011-08-20 10:15         ` Stefan Weil
  2 siblings, 0 replies; 25+ messages in thread
From: Stefan Weil @ 2011-08-20 10:15 UTC (permalink / raw)
  To: Bug 826363; +Cc: qemu-devel

Am 20.08.2011 10:50, schrieb Stefan Weil:
> Am 17.08.2011 18:44, schrieb Stefan Hajnoczi:
>> On Wed, Aug 17, 2011 at 5:29 PM, Stefan Hajnoczi <stefanha@gmail.com> 
>> wrote:
>>> On Tue, Aug 16, 2011 at 7:07 PM, Steve Si 
>>> <826363@bugs.launchpad.net> wrote:
>>>> I got binaries from http://homepage3.nifty.com/takeda-toshiya/
>>>>
>>>> tested under Win 7 64-bit as User=Administrator
>>>>
>>>> qemu10.6 - works  makes      16/08/2011  18:43     3,096,481,792 
>>>> test.raw
>>>> qemu11.1 - works  makes      16/08/2011  18:43     3,096,481,792 
>>>> test.raw
>>>> qemu12.1 - crashes !
>>>> qemu12.2 - crashes !
>>>> qemu12.5 - error while writing
>>>
>>> I think this crash->error transition is explained by:
>>>
>>> commit 8cef921d18025b4ce4e749eed391308033fee232
>>> Author: TeLeMan <geleman@gmail.com>
>>> Date:   Mon Feb 8 16:20:00 2010 +0800
>>>
>>>    qemu-img: use the heap instead of the huge stack array for win32
>>>
>>> But we still don't know why you are getting the write error.  It would
>>> be fairly easy to find that out by building QEMU from source and
>>> adding fprintf() where the write fails - print out the error code and
>>> sector number.
>
> The current code only supports images (any format) with less than
> 4 GiB (maybe even less than 2 GiB).
>
> This limitation is caused by the usage of function ftruncate to create
> the destination file. ftruncate takes a long (32 bit) parameter.

I did not notice that ftruncate is mapped to qemu_ftruncate64, so my
analysis was not correct. The implementation of qemu_ftruncate64
was buggy. It's fixed now, and working binaries are available from
http://qemu.weilnetz.de/w32/2011-08-20/.

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

* Re: [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64
  2011-08-20 10:10         ` [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64 Stefan Weil
@ 2011-08-20 12:01           ` Stefan Weil
  2011-08-22 16:32           ` Anthony Liguori
  1 sibling, 0 replies; 25+ messages in thread
From: Stefan Weil @ 2011-08-20 12:01 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: QEMU Developers

Am 20.08.2011 12:10, schrieb Stefan Weil:
> SetFilePointer returns INVALID_SET_FILE_POINTER when it fails.
> In addition, GetLastError must be checked.
>
> The first call of SetFilePointer did not use INVALID_SET_FILE_POINTER,
> the second call used wrong error handling.
>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
> ---
>   block/raw-win32.c |    8 ++++++--
>   1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/block/raw-win32.c b/block/raw-win32.c
> index e47cfe0..b7dd357 100644
> --- a/block/raw-win32.c
> +++ b/block/raw-win32.c
> @@ -41,6 +41,7 @@ typedef struct BDRVRawState {
>   int qemu_ftruncate64(int fd, int64_t length)
>   {
>       LARGE_INTEGER li;
> +    DWORD dw;
>       LONG high;
>       HANDLE h;
>       BOOL res;
> @@ -53,12 +54,15 @@ int qemu_ftruncate64(int fd, int64_t length)
>       /* get current position, ftruncate do not change position */
>       li.HighPart = 0;
>       li.LowPart = SetFilePointer (h, 0,&li.HighPart, FILE_CURRENT);
> -    if (li.LowPart == 0xffffffffUL&&  GetLastError() != NO_ERROR)
> +    if (li.LowPart == INVALID_SET_FILE_POINTER&&  GetLastError() != NO_ERROR) {
>   	return -1;
> +    }
>
>       high = length>>  32;
> -    if (!SetFilePointer(h, (DWORD) length,&high, FILE_BEGIN))
> +    dw = SetFilePointer(h, (DWORD) length,&high, FILE_BEGIN);
> +    if (dw == INVALID_SET_FILE_POINTER&&  GetLastError() != NO_ERROR) {
>   	return -1;
> +    }
>       res = SetEndOfFile(h);
>
>       /* back to old position */

This is a bug fix, please apply it to git master and stable-0.15.

Thanks,
Stefan W.

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (6 preceding siblings ...)
  2011-08-19 19:06 ` Steve Si
@ 2011-08-20 12:21 ` Stefan Weil
  2011-08-20 17:13 ` Steve Si
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Stefan Weil @ 2011-08-20 12:21 UTC (permalink / raw)
  To: qemu-devel

A patch is available here:
http://patchwork.ozlabs.org/patch/110762/

** Changed in: qemu
       Status: New => Fix Committed

** Changed in: qemu
     Assignee: (unassigned) => Stefan Weil (ubuntu-weilnetz)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Committed

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (7 preceding siblings ...)
  2011-08-20 12:21 ` Stefan Weil
@ 2011-08-20 17:13 ` Steve Si
  2011-08-27 16:23 ` Steve Si
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Steve Si @ 2011-08-20 17:13 UTC (permalink / raw)
  To: qemu-devel

If someone could give me a link to a compiled binary, I will test this -
thanks.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Committed

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* Re: [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64
  2011-08-20 10:10         ` [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64 Stefan Weil
  2011-08-20 12:01           ` Stefan Weil
@ 2011-08-22 16:32           ` Anthony Liguori
  1 sibling, 0 replies; 25+ messages in thread
From: Anthony Liguori @ 2011-08-22 16:32 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

On 08/20/2011 05:10 AM, Stefan Weil wrote:
> SetFilePointer returns INVALID_SET_FILE_POINTER when it fails.
> In addition, GetLastError must be checked.
>
> The first call of SetFilePointer did not use INVALID_SET_FILE_POINTER,
> the second call used wrong error handling.
>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   block/raw-win32.c |    8 ++++++--
>   1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/block/raw-win32.c b/block/raw-win32.c
> index e47cfe0..b7dd357 100644
> --- a/block/raw-win32.c
> +++ b/block/raw-win32.c
> @@ -41,6 +41,7 @@ typedef struct BDRVRawState {
>   int qemu_ftruncate64(int fd, int64_t length)
>   {
>       LARGE_INTEGER li;
> +    DWORD dw;
>       LONG high;
>       HANDLE h;
>       BOOL res;
> @@ -53,12 +54,15 @@ int qemu_ftruncate64(int fd, int64_t length)
>       /* get current position, ftruncate do not change position */
>       li.HighPart = 0;
>       li.LowPart = SetFilePointer (h, 0,&li.HighPart, FILE_CURRENT);
> -    if (li.LowPart == 0xffffffffUL&&  GetLastError() != NO_ERROR)
> +    if (li.LowPart == INVALID_SET_FILE_POINTER&&  GetLastError() != NO_ERROR) {
>   	return -1;
> +    }
>
>       high = length>>  32;
> -    if (!SetFilePointer(h, (DWORD) length,&high, FILE_BEGIN))
> +    dw = SetFilePointer(h, (DWORD) length,&high, FILE_BEGIN);
> +    if (dw == INVALID_SET_FILE_POINTER&&  GetLastError() != NO_ERROR) {
>   	return -1;
> +    }
>       res = SetEndOfFile(h);
>
>       /* back to old position */

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (8 preceding siblings ...)
  2011-08-20 17:13 ` Steve Si
@ 2011-08-27 16:23 ` Steve Si
  2011-08-27 19:42 ` Stefan Weil
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Steve Si @ 2011-08-27 16:23 UTC (permalink / raw)
  To: qemu-devel

I have applied the patch now and can confirm it works. Would this bug
also affect qemu.exe  for x86_64?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Committed

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (9 preceding siblings ...)
  2011-08-27 16:23 ` Steve Si
@ 2011-08-27 19:42 ` Stefan Weil
  2012-02-15  6:17 ` Stefan Weil
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Stefan Weil @ 2011-08-27 19:42 UTC (permalink / raw)
  To: qemu-devel

The patch fixes qemu_ftruncate64 (ftruncate) which is also called from
qemu.exe, qemu-system-x86_64.exe and other executables, so the bug
affects them all.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Committed

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (10 preceding siblings ...)
  2011-08-27 19:42 ` Stefan Weil
@ 2012-02-15  6:17 ` Stefan Weil
  2013-02-03  9:28 ` Aaron Bouzek
  2013-02-03  9:38 ` Aaron Bouzek
  13 siblings, 0 replies; 25+ messages in thread
From: Stefan Weil @ 2012-02-15  6:17 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Released

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (11 preceding siblings ...)
  2012-02-15  6:17 ` Stefan Weil
@ 2013-02-03  9:28 ` Aaron Bouzek
  2013-02-03  9:38 ` Aaron Bouzek
  13 siblings, 0 replies; 25+ messages in thread
From: Aaron Bouzek @ 2013-02-03  9:28 UTC (permalink / raw)
  To: qemu-devel

Did this bug come back, or is "error while reading" unrelated but
similar?

Oh look, Debian is using an old version, what are the odds?

Distributor ID:	Debian
Description:	Debian GNU/Linux 6.0.6 (squeeze)
Release:	6.0.6
Codename:	squeeze
root@nakvm:~# qemu-img --help
qemu-img version 0.12.5, Copyright (c) 2004-2008 Fabrice Bellard
usage: qemu-img command [command options]
QEMU disk image utility

So now I get to figure out where to get a new copy...

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Released

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

* [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files
  2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
                   ` (12 preceding siblings ...)
  2013-02-03  9:28 ` Aaron Bouzek
@ 2013-02-03  9:38 ` Aaron Bouzek
  13 siblings, 0 replies; 25+ messages in thread
From: Aaron Bouzek @ 2013-02-03  9:38 UTC (permalink / raw)
  To: qemu-devel

Or an old copy because Ubuntu proffers 1.0 which works fine on the same
image.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/826363

Title:
  qemu-img convert does not work with vdi files

Status in QEMU:
  Fix Released

Bug description:
  qemu-img.exe convert -O raw  myfile.vdi zz.raw

  reports 'error while writing' both in 0.15.0 and Beta rc2
  v0.11.1 works fine on same file. myfile.vdi is 3.9GB made by VirtualBox.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/826363/+subscriptions

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

end of thread, other threads:[~2013-02-03  9:45 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-14 16:32 [Qemu-devel] [Bug 826363] [NEW] qemu-img convert does not work with vdi files Steve Si
2011-08-14 21:25 ` [Qemu-devel] [Bug 826363] " Steve Si
2011-08-15 21:12 ` [Qemu-devel] [Bug 826363] [NEW] " Stefan Hajnoczi
2011-08-15 22:59 ` [Qemu-devel] [Bug 826363] " Steve Si
2011-08-16 13:10   ` Stefan Hajnoczi
2011-08-16 18:07 ` Steve Si
2011-08-17 16:29   ` Stefan Hajnoczi
2011-08-17 16:44     ` Stefan Hajnoczi
2011-08-20  8:50       ` Stefan Weil
2011-08-20  8:57         ` Michael Tokarev
2011-08-20 10:10         ` [Qemu-devel] [PATCH] w32: Fix qemu_ftruncate64 Stefan Weil
2011-08-20 12:01           ` Stefan Weil
2011-08-22 16:32           ` Anthony Liguori
2011-08-20 10:15         ` [Qemu-devel] [Bug 826363] Re: qemu-img convert does not work with vdi files Stefan Weil
2011-08-17 18:46 ` Steve Si
2011-08-17 19:05 ` Steve Si
2011-08-19  4:14   ` Stefan Hajnoczi
2011-08-19 19:06 ` Steve Si
2011-08-20 12:21 ` Stefan Weil
2011-08-20 17:13 ` Steve Si
2011-08-27 16:23 ` Steve Si
2011-08-27 19:42 ` Stefan Weil
2012-02-15  6:17 ` Stefan Weil
2013-02-03  9:28 ` Aaron Bouzek
2013-02-03  9:38 ` Aaron Bouzek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.