Bug 581045

Summary: 'download' command corrupts very large files
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: mbooth, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-15 16:30:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard W.M. Jones 2010-04-09 21:38:41 UTC
Description of problem:

Not entirely sure about this one, but I thought I observed a download
of a very large device producing a corrupt local file.

Version-Release number of selected component (if applicable):

1.3.1

How reproducible:

?

Steps to Reproduce:

Get md5 of some large (> 4 GB) device within an image :-

  guestfish --ro -a disk.img run : mkmountpoint /foo : checksum md5 /../dev/vda1

Download same device and checksum it :-

  guestfish --ro -a disk.img run : download /dev/vda1 local.img
  md5sum local.img

Actual results:

Difference found in a 10 GB image near to the 4 GB point.

Expected results:

Obviously there should be no difference.

Additional info:

Comment 1 Richard W.M. Jones 2010-05-12 15:35:07 UTC
Since we fixed another bug you can no longer use /.. to escape
from the appliance, so the reproducer from comment 0 no longer
works.

Instead do this with guestfish >= 1.3:

$ virt-list-partitions -hl /path/to/disk.img
/dev/sda1 ntfs 100.0M
/dev/sda2 ntfs 15.9G

Choose a large (> 4 GB) partition or LV, and then do:

$ guestfish --ro -a /path/to/disk.img run : checksum-device md5 /dev/sda2
7585d6e5fd2f7608ded54106dac0cc59

Then repeatedly download and checksum:

$ guestfish --ro -a /path/to/disk,img run : download /dev/sda2 local.img
$ md5sum local.img

repeating these last two commands until the checksum does not
match the first checksum.

Comment 2 Richard W.M. Jones 2010-05-15 12:48:33 UTC
I ran some very long tests on my machine, comparing the known
good disk image with subsequent downloads that were failing.

Comparative results are below (output from 'cmp -l' command -
the first number is the offset and the second and third numbers
are the good and bad bytes at this offset, in octal):

[image 1]
 4484845765 215 205
11416690693 234 334

[image 2]
16850120709 207 307
16850120773  47 147

[image 3]
16142352581 230 220

Based on this, I believe this is more likely to be a bit error
in the memory of my test machine.

I am continuing to perform the tests on other machines.

Comment 3 Richard W.M. Jones 2010-05-15 16:30:11 UTC
I cannot reproduce this on any other machine apart
from my first test machine.  Damn, memory error :-(
For now I am closing this as NOTABUG, please feel
free to reopen if it is ever reproduced.