Bug 114540 - tar corrupts archives with files >4GB
Summary: tar corrupts archives with files >4GB
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Beta 4
Hardware: Other All
: P5 - None : Critical
Target Milestone: ---
Assignee: Mads Martin Joergensen
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 20:20 UTC by Carl-Daniel Hailfinger
Modified: 2005-09-01 09:37 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carl-Daniel Hailfinger 2005-08-31 20:20:15 UTC
tar corrupts archives with sparse files >4 GB. Testcase follows:

   % echo "hello" | dd of=x bs=1 seek=4G
   % ls -l x
   -rw-rw-r--  1 szaka szaka 4294967302 Mar  3 22:40 x
   % tar cSf x.tar x
   % ls -l x.tar
   -rw-rw-r--  1 szaka szaka      10240 Mar  3 22:40 x.tar
   % tar vtf x.tar
   -rw-rw-r-- szaka/szaka 4294967302 2005-03-03 22:40:07 x
   % tar xf x.tar   (same result by 'tar xSf x.tar')
   % ls -l x
   -rw-rw-r--  1 szaka szaka          6 Mar  3 22:40 x



The thread at http://lists.gnu.org/archive/html/bug-tar/2005-03/msg00004.html
has more details.

The fix below is already merged in current tar sources.

Index: src/sparse.c
--- tar-1.15.1/src/sparse.c     2004-09-06 14:30:57.000000000 +0300
+++ tar-1.15.1-n/src/sparse.c   2005-03-04 00:50:05.000000000 +0200
@@ -1,6 +1,6 @@
 /* Functions for dealing with sparse files
 
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -182,7 +182,7 @@ sparse_scan_file (struct tar_sparse_file
 {
   static char buffer[BLOCKSIZE];
   size_t count;
-  size_t offset = 0;
+  off_t offset = 0;
   struct sp_array sp = {0, 0};
 
   if (!lseek_or_error (file, 0, SEEK_SET))
Comment 1 Carl-Daniel Hailfinger 2005-08-31 20:23:31 UTC
"The fix below is already merged in current tar sources."

Sorry, I was unclear. The fix is already merged in current tar sources, but the
latest official tar release is too old to contain the fix. So please merge the
patch. Thanks!
Comment 2 Mads Martin Joergensen 2005-09-01 09:37:07 UTC
Fixed and submitted for STABLE