[tar/f20] paxutils: fix sparse file detection based on fstat()

Pavel Raiskup praiskup at fedoraproject.org
Tue Oct 29 09:14:39 UTC 2013


commit b10789d1c919c39c2f6e390fa43aed7b59215d1f
Author: Pavel Raiskup <praiskup at redhat.com>
Date:   Tue Oct 29 08:56:49 2013 +0100

    paxutils: fix sparse file detection based on fstat()
    
    (cherry pick from fc21)
    
    Resolves: #1024095
    Version: 1.26-29

 tar-1.26-sparse-stat-detection.patch |   22 ++++++++++++++++++++++
 tar.spec                             |   12 +++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/tar-1.26-sparse-stat-detection.patch b/tar-1.26-sparse-stat-detection.patch
new file mode 100644
index 0000000..3eb3fb8
--- /dev/null
+++ b/tar-1.26-sparse-stat-detection.patch
@@ -0,0 +1,22 @@
+diff --git a/lib/system.h b/lib/system.h
+index ef46267..e7f531c 100644
+--- a/lib/system.h
++++ b/lib/system.h
+@@ -389,9 +389,16 @@ extern int errno;
+ # define ST_NBLOCKSIZE 512
+ #endif
+ 
++/* Network Appliance file systems store small files directly in the
++   inode if st_size <= 64; in this case the number of blocks can be
++   zero.  Perhaps other file systems have similar problems; so,
++   somewhat arbitrarily, do not consider a file to be sparse if
++   it has no blocks but st_size < ST_NBLOCKSIZE.  */
+ #define ST_IS_SPARSE(st)                                  \
+   (ST_NBLOCKS (st)                                        \
+-    < ((st).st_size / ST_NBLOCKSIZE + ((st).st_size % ST_NBLOCKSIZE != 0)))
++   < ((st).st_size / ST_NBLOCKSIZE			  \
++      + ((st).st_size % ST_NBLOCKSIZE != 0		  \
++	 && (st).st_size / ST_NBLOCKSIZE != 0)))
+ 
+ /* Declare standard functions.  */
+ 
diff --git a/tar.spec b/tar.spec
index 5a944be..0856a0d 100644
--- a/tar.spec
+++ b/tar.spec
@@ -5,7 +5,7 @@ Summary: A GNU file archiving program
 Name: tar
 Epoch: 2
 Version: 1.26
-Release: 28%{?dist}
+Release: 29%{?dist}
 License: GPLv3+
 Group: Applications/Archiving
 URL: http://www.gnu.org/software/tar/
@@ -119,6 +119,12 @@ Patch17: tar-1.26-docu-xattrs.patch
 
 Patch18: tar-1.26-xattrs-include-implies-xattrs.patch
 
+# If the 'st_size' != 0 && count(blocks) == 0 && st_size < size(block), this
+# does not necessarily must be a sparse file.
+# ~> upstream (paxutils):  986382a0bb3261
+# ~> #1024095
+Patch19: tar-1.27-sparse-stat-detection.patch
+
 # Silence gcc warnings
 # ~> upstream tar: 17f99bc6f, 5bb0433
 # ~> upstream paxutils: 0b3d84a0
@@ -175,6 +181,7 @@ the rmt package on the remote box.
 %patch16 -p1 -b .birthtime
 %patch17 -p1 -b .xattrs-documentation
 %patch18 -p1 -b .xattrs-if-xattrs-include
+%patch19 -p1 -b .sparse-stat-detection
 %patch999 -p1 -b .silence-gcc
 
 autoreconf -v
@@ -234,6 +241,9 @@ fi
 %{_infodir}/tar.info*
 
 %changelog
+* Tue Oct 29 2013 Pavel Raiskup <praiskup at redhat.com> - 1.26-29
+- sparse file detection based on fstat() fix (#1024095)
+
 * Mon Sep 09 2013 Pavel Raiskup <praiskup at redhat.com> - 1.26-28
 - add documenation for xattrs-like options (#996753)
 - the --xattrs-include implies --xattrs now (#965969)


More information about the scm-commits mailing list