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

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