diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-06-17 03:40:36 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-06-17 03:40:36 +0000 |
commit | 2a816c9c6258489cd3d0a228407b84be9215e80c (patch) | |
tree | fd7c03f0872d9924011257a3b4b087e2894ad863 /app-arch | |
parent | Addes sys-apps/man-1.5 (diff) | |
download | gentoo-2-2a816c9c6258489cd3d0a228407b84be9215e80c.tar.gz gentoo-2-2a816c9c6258489cd3d0a228407b84be9215e80c.tar.bz2 gentoo-2-2a816c9c6258489cd3d0a228407b84be9215e80c.zip |
Add patch from upstream cvs / fedora.
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'app-arch')
-rw-r--r-- | app-arch/tar/ChangeLog | 6 | ||||
-rw-r--r-- | app-arch/tar/files/tar-1.15.1-lseek.patch | 176 | ||||
-rw-r--r-- | app-arch/tar/tar-1.15.1.ebuild | 3 |
3 files changed, 183 insertions, 2 deletions
diff --git a/app-arch/tar/ChangeLog b/app-arch/tar/ChangeLog index 73c55fb2f2df..5b4990f99c8d 100644 --- a/app-arch/tar/ChangeLog +++ b/app-arch/tar/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for app-arch/tar # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/ChangeLog,v 1.49 2005/06/17 03:35:45 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/ChangeLog,v 1.50 2005/06/17 03:40:36 vapier Exp $ + + 17 Jun 2005; Mike Frysinger <vapier@gentoo.org> + +files/tar-1.15.1-lseek.patch, tar-1.15.1.ebuild: + Add patch from upstream cvs / fedora. 17 Jun 2005; Mike Frysinger <vapier@gentoo.org> +files/tar-1.15.1-less-verbose-newer.patch, tar-1.15.1.ebuild: diff --git a/app-arch/tar/files/tar-1.15.1-lseek.patch b/app-arch/tar/files/tar-1.15.1-lseek.patch new file mode 100644 index 000000000000..f4eeb6d7441e --- /dev/null +++ b/app-arch/tar/files/tar-1.15.1-lseek.patch @@ -0,0 +1,176 @@ +revision 1.12 +date: 2005/03/03 23:13:30; author: gray; state: Exp; lines: +1 -1 +(sparse_scan_file): Bugfix. offset had incorrect type. + +revision 1.11 +date: 2005/02/02 11:01:49; author: gray; state: Exp; lines: +59 -14 +Extract sparse files even if the output fd is not seekable. + +Index: src/sparse.c +=================================================================== +RCS file: /cvsroot/tar/tar/src/sparse.c,v +retrieving revision 1.10 +retrieving revision 1.12 +diff -u -p -r1.10 -r1.12 +--- src/sparse.c 6 Sep 2004 14:28:56 -0000 1.10 ++++ src/sparse.c 3 Mar 2005 23:13:30 -0000 1.12 +@@ -46,6 +46,9 @@ struct tar_sparse_optab + struct tar_sparse_file + { + int fd; /* File descriptor */ ++ bool seekable; /* Is fd seekable? */ ++ size_t offset; /* Current offset in fd if seekable==false. ++ Otherwise unused */ + size_t dumped_size; /* Number of bytes actually written + to the archive */ + struct tar_stat_info *stat_info; /* Information about the file */ +@@ -54,6 +57,39 @@ struct tar_sparse_file + reqiure */ + }; + ++/* Dump zeros to file->fd until offset is reached. It is used instead of ++ lseek if the output file is not seekable */ ++static long ++dump_zeros (struct tar_sparse_file *file, off_t offset) ++{ ++ char buf[BLOCKSIZE]; ++ ++ if (offset - file->offset < 0) ++ { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ memset (buf, 0, sizeof buf); ++ while (file->offset < offset) ++ { ++ size_t size = offset - file->offset; ++ size_t wrbytes; ++ ++ if (size > sizeof buf) ++ size = sizeof buf; ++ wrbytes = write (file->fd, buf, size); ++ if (wrbytes <= 0) ++ { ++ if (wrbytes == 0) ++ errno = EINVAL; ++ return -1; ++ } ++ file->offset += wrbytes; ++ } ++ return file->offset; ++} ++ + static bool + tar_sparse_member_p (struct tar_sparse_file *file) + { +@@ -130,9 +166,16 @@ tar_sparse_fixup_header (struct tar_spar + + + static bool +-lseek_or_error (struct tar_sparse_file *file, off_t offset, int whence) ++lseek_or_error (struct tar_sparse_file *file, off_t offset) + { +- if (lseek (file->fd, offset, whence) < 0) ++ off_t off; ++ ++ if (file->seekable) ++ off = lseek (file->fd, offset, SEEK_SET); ++ else ++ off = dump_zeros (file, offset); ++ ++ if (off < 0) + { + seek_diag_details (file->stat_info->orig_file_name, offset); + return false; +@@ -182,10 +225,10 @@ sparse_scan_file (struct tar_sparse_file + { + static char buffer[BLOCKSIZE]; + size_t count; +- size_t offset = 0; ++ off_t offset = 0; + struct sp_array sp = {0, 0}; + +- if (!lseek_or_error (file, 0, SEEK_SET)) ++ if (!lseek_or_error (file, 0)) + return false; + clear_block (buffer); + +@@ -269,8 +312,7 @@ sparse_dump_region (struct tar_sparse_fi + union block *blk; + off_t bytes_left = file->stat_info->sparse_map[i].numbytes; + +- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset, +- SEEK_SET)) ++ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset)) + return false; + + while (bytes_left > 0) +@@ -304,8 +346,7 @@ sparse_extract_region (struct tar_sparse + { + size_t write_size; + +- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset, +- SEEK_SET)) ++ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset)) + return false; + + write_size = file->stat_info->sparse_map[i].numbytes; +@@ -313,7 +354,7 @@ sparse_extract_region (struct tar_sparse + if (write_size == 0) + { + /* Last block of the file is a hole */ +- if (sys_truncate (file->fd)) ++ if (file->seekable && sys_truncate (file->fd)) + truncate_warn (file->stat_info->orig_file_name); + } + else while (write_size > 0) +@@ -330,6 +371,7 @@ sparse_extract_region (struct tar_sparse + count = full_write (file->fd, blk->buffer, wrbytes); + write_size -= count; + file->dumped_size += count; ++ file->offset += count; + if (count != wrbytes) + { + write_error_details (file->stat_info->orig_file_name, +@@ -351,7 +393,9 @@ sparse_dump_file (int fd, struct tar_sta + + file.stat_info = st; + file.fd = fd; +- ++ file.seekable = true; /* File *must* be seekable for dump to work */ ++ file.offset = 0; ++ + if (!sparse_select_optab (&file) + || !tar_sparse_init (&file)) + return dump_status_not_implemented; +@@ -414,7 +458,9 @@ sparse_extract_file (int fd, struct tar_ + + file.stat_info = st; + file.fd = fd; +- ++ file.seekable = lseek (fd, 0, SEEK_SET) == 0; ++ file.offset = 0; ++ + if (!sparse_select_optab (&file) + || !tar_sparse_init (&file)) + return dump_status_not_implemented; +@@ -450,7 +496,7 @@ static char diff_buffer[BLOCKSIZE]; + static bool + check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end) + { +- if (!lseek_or_error (file, beg, SEEK_SET)) ++ if (!lseek_or_error (file, beg)) + return false; + + while (beg < end) +@@ -486,8 +532,7 @@ check_data_region (struct tar_sparse_fil + { + size_t size_left; + +- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset, +- SEEK_SET)) ++ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset)) + return false; + size_left = file->stat_info->sparse_map[i].numbytes; + while (size_left > 0) diff --git a/app-arch/tar/tar-1.15.1.ebuild b/app-arch/tar/tar-1.15.1.ebuild index 1e32b96024c6..714edb4b968a 100644 --- a/app-arch/tar/tar-1.15.1.ebuild +++ b/app-arch/tar/tar-1.15.1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.15.1.ebuild,v 1.14 2005/06/17 03:35:45 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.15.1.ebuild,v 1.15 2005/06/17 03:40:36 vapier Exp $ inherit flag-o-matic eutils @@ -27,6 +27,7 @@ src_unpack() { epatch "${FILESDIR}"/${P}-gcc4-test.patch #88214 epatch "${FILESDIR}"/${P}-dont-abort-long-names.patch #87540 epatch "${FILESDIR}"/${P}-less-verbose-newer.patch #86467 + epatch "${FILESDIR}"/${P}-lseek.patch cp "${FILESDIR}"/append.at tests/ } |