rpms/tar/devel tar-1.15.1-vfatTruncate.patch, NONE, 1.1 tar.spec, 1.28, 1.29
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Feb 6 11:17:49 UTC 2006
Author: pvrabec
Update of /cvs/dist/rpms/tar/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16053
Modified Files:
tar.spec
Added Files:
tar-1.15.1-vfatTruncate.patch
Log Message:
fix extracting sparse files to a filesystem like vfat,
when ftruncate may fail to grow the size of a file.(#179507)
tar-1.15.1-vfatTruncate.patch:
system.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletion(-)
--- NEW FILE tar-1.15.1-vfatTruncate.patch ---
--- tar-1.15.1/src/system.c.vfatTruncate 2004-09-06 07:31:00.000000000 -0400
+++ tar-1.15.1/src/system.c 2006-02-03 14:40:51.000000000 -0500
@@ -272,8 +272,25 @@
int
sys_truncate (int fd)
{
+ struct stat st;
off_t pos = lseek (fd, (off_t) 0, SEEK_CUR);
- return pos < 0 ? -1 : ftruncate (fd, pos);
+
+ if ( pos < 0)
+ return -1;
+
+ if ( ftruncate(fd, pos) && errno == EPERM ) {
+ /* wrapper around ftruncate:
+ * ftruncate may fail to grow the size of a file with some OS and filesystem
+ * combinations. Linux and vfat/fat is one example. If this is the case do
+ * a write to grow the file to the desired length.
+ */
+ if( (fstat( fd, &st ) == -1) ||
+ (st.st_size >= pos) ||
+ (lseek( fd, pos - 1, SEEK_SET) == (off_t)-1) ||
+ (write( fd, "\0", 1) == -1) )
+ return -1;
+ }
+ return 0;
}
/* Return nonzero if NAME is the name of a regular file, or if the file
Index: tar.spec
===================================================================
RCS file: /cvs/dist/rpms/tar/devel/tar.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- tar.spec 9 Dec 2005 22:43:31 -0000 1.28
+++ tar.spec 6 Feb 2006 11:17:45 -0000 1.29
@@ -1,7 +1,7 @@
Summary: A GNU file archiving program.
Name: tar
Version: 1.15.1
-Release: 11.1
+Release: 12
License: GPL
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@@ -16,6 +16,7 @@
Patch12: tar-1.15.1-sparseTotals.patch
Patch13: tar-1.15.1-newerOption.patch
Patch14: tar-1.15.1-padCorrectly.patch
+Patch15: tar-1.15.1-vfatTruncate.patch
Prereq: info
BuildRequires: autoconf automake gzip
@@ -43,6 +44,7 @@
%patch12 -p1 -b .sparseTotals
%patch13 -p1 -b .newerOption
%patch14 -p1 -b .padCorrectly
+%patch15 -p1 -b .vfatTruncate
%build
@@ -113,6 +115,10 @@
%{_infodir}/tar.info*
%changelog
+* Mon Feb 06 2006 Peter Vrabec <pvrabec at redhat.com> 1.15.1-12
+- fix extracting sparse files to a filesystem like vfat,
+ when ftruncate may fail to grow the size of a file.(#179507)
+
* Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
- rebuilt
More information about the fedora-cvs-commits
mailing list