fix extracting sparse files to a filesystem like vfat, when ftruncate may
fail to grow the size of a file.(#179507)
This commit is contained in:
parent
415b3f9707
commit
6c5016002f
29
tar-1.15.1-vfatTruncate.patch
Normal file
29
tar-1.15.1-vfatTruncate.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
--- 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
|
8
tar.spec
8
tar.spec
@ -1,7 +1,7 @@
|
|||||||
Summary: A GNU file archiving program.
|
Summary: A GNU file archiving program.
|
||||||
Name: tar
|
Name: tar
|
||||||
Version: 1.15.1
|
Version: 1.15.1
|
||||||
Release: 11.1
|
Release: 12
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Applications/Archiving
|
Group: Applications/Archiving
|
||||||
URL: http://www.gnu.org/software/tar/
|
URL: http://www.gnu.org/software/tar/
|
||||||
@ -16,6 +16,7 @@ Patch11: tar-1.15.1-lseek.patch
|
|||||||
Patch12: tar-1.15.1-sparseTotals.patch
|
Patch12: tar-1.15.1-sparseTotals.patch
|
||||||
Patch13: tar-1.15.1-newerOption.patch
|
Patch13: tar-1.15.1-newerOption.patch
|
||||||
Patch14: tar-1.15.1-padCorrectly.patch
|
Patch14: tar-1.15.1-padCorrectly.patch
|
||||||
|
Patch15: tar-1.15.1-vfatTruncate.patch
|
||||||
|
|
||||||
Prereq: info
|
Prereq: info
|
||||||
BuildRequires: autoconf automake gzip
|
BuildRequires: autoconf automake gzip
|
||||||
@ -43,6 +44,7 @@ the rmt package.
|
|||||||
%patch12 -p1 -b .sparseTotals
|
%patch12 -p1 -b .sparseTotals
|
||||||
%patch13 -p1 -b .newerOption
|
%patch13 -p1 -b .newerOption
|
||||||
%patch14 -p1 -b .padCorrectly
|
%patch14 -p1 -b .padCorrectly
|
||||||
|
%patch15 -p1 -b .vfatTruncate
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -113,6 +115,10 @@ fi
|
|||||||
%{_infodir}/tar.info*
|
%{_infodir}/tar.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 06 2006 Peter Vrabec <pvrabec@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@redhat.com>
|
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
|
||||||
- rebuilt
|
- rebuilt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user