Blame SOURCES/tar-1.26-pax-big-sparse-files.patch

b77676
diff --git a/NEWS b/NEWS
b77676
index 8aeae33..8f3c416 100644
b77676
--- a/NEWS
b77676
+++ b/NEWS
b77676
@@ -1,10 +1,15 @@
b77676
 GNU tar NEWS - User visible changes. 2012-11-19
b77676
 Please send GNU tar bug reports to <bug-tar@gnu.org>
b77676
 
b77676
+** Sparse files with large data
b77676
+
b77676
+When creating a PAX-format archive, tar no longer arbitrarily restricts
b77676
+the size of the representation of a sparse file to be less than 8 GiB.
b77676
+
b77676
 
b77676
 version 1.26 - Sergey Poznyakoff, 2011-03-12
b77676
 
b77676
-* Bugfixes
b77676
+* Bug fixes
b77676
 
b77676
 ** Fix the --verify option, which broke in version 1.24.
b77676
 
b77676
diff --git a/src/sparse.c b/src/sparse.c
b77676
index 4b2f982..cfd0c66 100644
b77676
--- a/src/sparse.c
b77676
+++ b/src/sparse.c
b77676
@@ -919,6 +919,18 @@ pax_sparse_member_p (struct tar_sparse_file *file)
b77676
           || file->stat_info->sparse_major > 0;
b77676
 }
b77676
 
b77676
+/* Start a header that uses the effective (shrunken) file size.  */
b77676
+static union block *
b77676
+pax_start_header (struct tar_stat_info *st)
b77676
+{
b77676
+  off_t realsize = st->stat.st_size;
b77676
+  union block *blk;
b77676
+  st->stat.st_size = st->archive_file_size;
b77676
+  blk = start_header (st);
b77676
+  st->stat.st_size = realsize;
b77676
+  return blk;
b77676
+}
b77676
+
b77676
 static bool
b77676
 pax_dump_header_0 (struct tar_sparse_file *file)
b77676
 {
b77676
@@ -968,9 +980,7 @@ pax_dump_header_0 (struct tar_sparse_file *file)
b77676
 	  return false;
b77676
 	}
b77676
     }
b77676
-  blk = start_header (file->stat_info);
b77676
-  /* Store the effective (shrunken) file size */
b77676
-  OFF_TO_CHARS (file->stat_info->archive_file_size, blk->header.size);
b77676
+  blk = pax_start_header (file->stat_info);
b77676
   finish_header (file->stat_info, blk, block_ordinal);
b77676
   if (save_file_name)
b77676
     {
b77676
@@ -1035,9 +1045,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
b77676
   if (strlen (file->stat_info->file_name) > NAME_FIELD_SIZE)
b77676
     file->stat_info->file_name[NAME_FIELD_SIZE] = 0;
b77676
 
b77676
-  blk = start_header (file->stat_info);
b77676
-  /* Store the effective (shrunken) file size */
b77676
-  OFF_TO_CHARS (file->stat_info->archive_file_size, blk->header.size);
b77676
+  blk = pax_start_header (file->stat_info);
b77676
   finish_header (file->stat_info, blk, block_ordinal);
b77676
   free (file->stat_info->file_name);
b77676
   file->stat_info->file_name = save_file_name;