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

Pavel Raiskup praiskup at fedoraproject.org
Tue Oct 29 08:16:21 UTC 2013


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

    paxutils: fix sparse file detection based on fstat()
    
    Resolves: #1024095
    Version: 1.27-2

 tar-1.27-sparse-stat-detection.patch |   22 ++++++++++++++++++++++
 tar.spec                             |   12 +++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/tar-1.27-sparse-stat-detection.patch b/tar-1.27-sparse-stat-detection.patch
new file mode 100644
index 0000000..3eb3fb8
--- /dev/null
+++ b/tar-1.27-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 606b0e6..8b71352 100644
--- a/tar.spec
+++ b/tar.spec
@@ -5,7 +5,7 @@ Summary: A GNU file archiving program
 Name: tar
 Epoch: 2
 Version: 1.27
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv3+
 Group: Applications/Archiving
 URL: http://www.gnu.org/software/tar/
@@ -64,6 +64,12 @@ Patch7: tar-1.26-docu-xattrs.patch
 
 Patch8: 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
+Patch9: tar-1.27-sparse-stat-detection.patch
+
 # run "make check" by default
 %bcond_without check
 
@@ -105,6 +111,7 @@ the rmt package on the remote box.
 %patch6 -p1 -b .print-xattrs-fix
 %patch7 -p1 -b .xattrs-documentation
 %patch8 -p1 -b .xattrs-if-xattrs-include
+%patch9 -p1 -b .sparse-stat-detection
 
 autoreconf -v
 
@@ -163,6 +170,9 @@ fi
 %{_infodir}/tar.info*
 
 %changelog
+* Tue Oct 29 2013 Pavel Raiskup <praiskup at redhat.com> - 1.27-2
+- sparse file detection based on fstat() fix (#1024095)
+
 * Wed Oct 09 2013 Ondrej Vasik <ovasik at redhat.com> - 1.27-1
 - new upstream release 1.27 (#1016288)
 


More information about the scm-commits mailing list