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

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