Subject: bug#12656: Re[2]: bug#12656: cp since 8.11 corrupts files

From: [email-masked]
Date: Tue, 16 Oct 2012 00:00:54 +0200

Hi Jim,

please find attached the output (compressed) of
        strace -s8 -oLOG cp819 $FILES $DEST

about 2700 writes a 64kB.

Thanks,
Mike

Mit freundlichen Grüßen
Mike Gerth

Dipl. Inf. Mike Gerth
+49 30 399 76 136
IT-Systemadministrator
AVM Audiovisuelles Marketing und Computersysteme GmbH 
Alt-Moabit 95, 10559 Berlin
HRB 23075 AG Charlottenburg
Geschäftsführer: Johannes Nill

Von:    Jim Meyering <[email-masked]>
An:     "Mike Gerth" <[email-masked]>
Kopie:  [email-masked]
Datum:  15.10.2012 19:51
Betreff:        Re: bug#12656: cp since 8.11 corrupts files

Mike Gerth wrote:
> I noticed an error in cp (8.11 upwards till 8.19) when copying many 
files
> from an fragmented ext3fs (to an empty partition).
>
> ERROR:
>         The copied file has exact length.
>         The SourceFile has in the middle a 4K-block filled with ZERO, 
the
> DestFile this 4k-block and the previous 4k-block also filled with ZERO.
>
>
> I can reproduce this:
>         Conditions:
>                 *I have a strong fragmented 110GB ext3-partition with 
>300
> Files
>                 *I have to copy about 100 files (ca. 15GB) to another
> HDD-Partition or ramdisk
>                 *cp must be 8.11 or higher (compiled under SLES11SP2
> kernel 3.0) (everything is ok with 6.11. 8.05..8.10)
>                 *Command:
>                         cp819    $FILES $DEST #here the corruption comes
>                         *$FILES is a list of about 100 DatabaseFiles. 
The
> last one is the file that becomes corrupted

Thanks a lot for the detailed report.
...
> But since the Files are Database files I can not provide it. Are there 
any
> tests that I can do?

Can you run this command, and then send us the part of the LOG file
that reads and writes the file that is corrupted, i.e., only the
presumably small fraction at the end:

    strace -s8 -oLOG cp819 $FILES $DEST

The interesting-to-us part will start with "open" syscalls that
operate on the src and dest corrupted files.

However, note that the read syscalls will expose a few bytes (8 per
block read -- per the -s8 option above) of the contents of your
final file.  If you're not comfortable with that, let us know
and we'll try to come up with something else.

If LOG is larger than say 40KB, please compress and attach e.g., LOG.xz.