paxutils: fix sparse file detection based on fstat()

Resolves: #1024095
Version: 1.27-2
This commit is contained in:
Pavel Raiskup 2013-10-29 08:56:49 +01:00
parent 4bcf8d01a3
commit f6493483ff
2 changed files with 33 additions and 1 deletions

View File

@ -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. */

View File

@ -5,7 +5,7 @@ Summary: A GNU file archiving program
Name: tar Name: tar
Epoch: 2 Epoch: 2
Version: 1.27 Version: 1.27
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/Archiving Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/ 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 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 # run "make check" by default
%bcond_without check %bcond_without check
@ -105,6 +111,7 @@ the rmt package on the remote box.
%patch6 -p1 -b .print-xattrs-fix %patch6 -p1 -b .print-xattrs-fix
%patch7 -p1 -b .xattrs-documentation %patch7 -p1 -b .xattrs-documentation
%patch8 -p1 -b .xattrs-if-xattrs-include %patch8 -p1 -b .xattrs-if-xattrs-include
%patch9 -p1 -b .sparse-stat-detection
autoreconf -v autoreconf -v
@ -163,6 +170,9 @@ fi
%{_infodir}/tar.info* %{_infodir}/tar.info*
%changelog %changelog
* Tue Oct 29 2013 Pavel Raiskup <praiskup@redhat.com> - 1.27-2
- sparse file detection based on fstat() fix (#1024095)
* Wed Oct 09 2013 Ondrej Vasik <ovasik@redhat.com> - 1.27-1 * Wed Oct 09 2013 Ondrej Vasik <ovasik@redhat.com> - 1.27-1
- new upstream release 1.27 (#1016288) - new upstream release 1.27 (#1016288)