GNU bug report logs - #12656
cp since 8.11 corrupts files

Previous Next

Package: coreutils;

Reported by: "Mike Gerth" <m.gerth <at> avm.de>

Date: Mon, 15 Oct 2012 15:56:01 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 12656 <at> debbugs.gnu.org (full text, mbox):

From: "Mike Gerth" <m.gerth <at> avm.de>
To: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
Cc: Jim Meyering <jim <at> meyering.net>, 12656 <at> debbugs.gnu.org
Subject: Re[3]: bug#12656: cp since 8.11 corrupts files
Date: Tue, 16 Oct 2012 10:24:22 +0200
[Message part 1 (text/plain, inline)]
Hi Alan,

the difference between bulk copy (then the corruption comes) and single 
file copy (everything ok) is:

diff /PatchLogBulk.txt /PatchLogSingle.txt
635c635
< Julius.nsf merged extent#3 off=18239488 len=155648 flags=0x1000
---
> Julius.nsf merged extent#3 off=18239488 len=159744 flags=0x1000



Thanks,
Mike





Von:    "Alan Curry" <pacman-cu <at> kosh.dhis.org>
An:     m.gerth <at> avm.de
Kopie:  jim <at> meyering.net (Jim Meyering), 12656 <at> debbugs.gnu.org
Datum:  16.10.2012 03:14
Betreff:        Re: bug#12656: Re[2]: bug#12656: cp since 8.11 corrupts 
files



The critical piece of the trace is here:

lseek(3, 18239488, SEEK_SET)            = 18239488
lseek(4, 18239488, SEEK_SET)            = 18239488
read(3, "\0\0\0\0\0\0\0\0"..., 65536)   = 65536
write(4, "\0\0\0\0\0\0\0\0"..., 65536)  = 65536
read(3, "?\0\r\0\20\0\0\37"..., 65536)  = 65536
write(4, "?\0\r\0\20\0\0\37"..., 65536) = 65536
read(3, "\20\0\0\377\0\20\0\0"..., 24576) = 24576
write(4, "\20\0\0\377\0\20\0\0"..., 24576) = 24576
lseek(3, 18403328, SEEK_SET)            = 18403328
lseek(4, 18403328, SEEK_SET)            = 18403328

The 24576-byte read and write should be 4096 bytes longer. cp has got the
extents mixed up somehow.

Here are some quick and dirty patches to make cp dump what it thinks the
extents are at a couple of different stages. It would be interesting to 
see
what they say about the troublesome file.

--- src/extent-scan.c            2012-10-15 19:24:55.112096929 -0500
+++ src/extent-scan.c            2012-10-15 19:56:22.533209742 -0500
@@ -131,6 +131,12 @@
                                   sizeof (struct extent_info));
 
       unsigned int i = 0;
+      for(i=0; i<fiemap->fm_mapped_extents; ++i)
+        fprintf(stderr, "fd %d extent#%d log=%llu len=%llu 
flags=0x%llx\n",
+                scan->fd, i,
+                (unsigned long long)fm_extents[i].fe_logical,
+                (unsigned long long)fm_extents[i].fe_length,
+                (unsigned long long)fm_extents[i].fe_flags);
       for (i = 0; i < fiemap->fm_mapped_extents; i++)
         {
           assert (fm_extents[i].fe_logical
--- src/copy.c           2012-10-15 18:55:39.397899266 -0500
+++ src/copy.c           2012-10-15 19:56:23.417209716 -0500
@@ -317,6 +317,12 @@
 
       unsigned int i;
       bool empty_extent = false;
+      for(i=0; i<scan.ei_count; ++i)
+        fprintf(stderr, "%s merged extent#%d off=%llu len=%llu 
flags=0x%llx\n",
+                src_name, i,
+                (unsigned long long)scan.ext_info[i].ext_logical,
+                (unsigned long long)scan.ext_info[i].ext_length,
+                (unsigned long long)scan.ext_info[i].ext_flags);
       for (i = 0; i < scan.ei_count || empty_extent; i++)
         {
           off_t ext_start;

-- 
Alan Curry

[Message part 2 (text/html, inline)]
[PatchlogSingle.txt.bz2 (application/octet-stream, attachment)]
[PatchlogBulk.txt.bz2 (application/octet-stream, attachment)]

This bug report was last modified 6 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.