diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-12-29 10:03:44 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-12-29 10:03:44 +0000 |
commit | 463eda5313e997c3eac57ae60e4eac2635b96acd (patch) | |
tree | 2326e82d6301ff0d71fda65e68ac17d4cd8f2072 /app-arch | |
parent | broken #252680 (diff) | |
download | gentoo-2-463eda5313e997c3eac57ae60e4eac2635b96acd.tar.gz gentoo-2-463eda5313e997c3eac57ae60e4eac2635b96acd.tar.bz2 gentoo-2-463eda5313e997c3eac57ae60e4eac2635b96acd.zip |
Revert an upstream change that breaks when piping data into tar as pointed out by Zac Medico #252680 by Etienne Hilson.
(Portage version: 2.2_rc18/cvs/Linux 2.6.28 x86_64)
Diffstat (limited to 'app-arch')
-rw-r--r-- | app-arch/tar/ChangeLog | 9 | ||||
-rw-r--r-- | app-arch/tar/files/tar-1.21-revert-pipe.patch | 123 | ||||
-rw-r--r-- | app-arch/tar/tar-1.21-r1.ebuild | 69 |
3 files changed, 200 insertions, 1 deletions
diff --git a/app-arch/tar/ChangeLog b/app-arch/tar/ChangeLog index e298978e59e2..bbb8a5eb595c 100644 --- a/app-arch/tar/ChangeLog +++ b/app-arch/tar/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-arch/tar # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/ChangeLog,v 1.137 2008/12/27 03:24:11 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/ChangeLog,v 1.138 2008/12/29 10:03:44 vapier Exp $ + +*tar-1.21-r1 (29 Dec 2008) + + 29 Dec 2008; Mike Frysinger <vapier@gentoo.org> + +files/tar-1.21-revert-pipe.patch, +tar-1.21-r1.ebuild: + Revert an upstream change that breaks when piping data into tar as pointed + out by Zac Medico #252680 by Etienne Hilson. *tar-1.21 (27 Dec 2008) diff --git a/app-arch/tar/files/tar-1.21-revert-pipe.patch b/app-arch/tar/files/tar-1.21-revert-pipe.patch new file mode 100644 index 000000000000..60ac7e665123 --- /dev/null +++ b/app-arch/tar/files/tar-1.21-revert-pipe.patch @@ -0,0 +1,123 @@ +http://bugs.gentoo.org/252680 + +revert this change: + +2008-11-25 Sergey Poznyakoff <gray@gnu.org.ua> + + Do not try to drain the input pipe before closing the + archive. + + * src/buffer.c (close_archive): Remove call to + sys_drain_input_pipe. Pass hit_eof as the second + argument to sys_wait_for_child. + * src/common.h (sys_drain_input_pipe): Remove + (sys_wait_for_child): Declare second argument. + * src/system.c (sys_drain_input_pipe): Remove. + (sys_wait_for_child): Take two arguments. The second one helps to + decide whether to tolerate child termination on SIGPIPE. + +diff --git a/src/buffer.c b/src/buffer.c +index 5f5457a..02a3e4c 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -848,6 +848,8 @@ close_archive (void) + flush_archive (); + } + ++ sys_drain_input_pipe (); ++ + compute_duration (); + if (verify_option) + verify_volume (); +@@ -855,7 +857,7 @@ close_archive (void) + if (rmtclose (archive) != 0) + close_error (*archive_name_cursor); + +- sys_wait_for_child (child_pid, hit_eof); ++ sys_wait_for_child (child_pid); + + tar_stat_destroy (¤t_stat_info); + if (save_name) +diff --git a/src/common.h b/src/common.h +index 9897b46..cc3483e 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -699,7 +699,8 @@ char *xheader_format_name (struct tar_stat_info *st, const char *fmt, + + void sys_detect_dev_null_output (void); + void sys_save_archive_dev_ino (void); +-void sys_wait_for_child (pid_t, bool); ++void sys_drain_input_pipe (void); ++void sys_wait_for_child (pid_t); + void sys_spawn_shell (void); + bool sys_compare_uid (struct stat *a, struct stat *b); + bool sys_compare_gid (struct stat *a, struct stat *b); +diff --git a/src/system.c b/src/system.c +index c90a40d..e57e6da 100644 +--- a/src/system.c ++++ b/src/system.c +@@ -1,7 +1,6 @@ + /* System-dependent calls for tar. + +- Copyright (C) 2003, 2004, 2005, 2006, 2007, +- 2008 Free Software Foundation, Inc. ++ Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the +@@ -52,7 +51,12 @@ sys_detect_dev_null_output (void) + } + + void +-sys_wait_for_child (pid_t child_pid, bool eof) ++sys_drain_input_pipe (void) ++{ ++} ++ ++void ++sys_wait_for_child (pid_t child_pid) + { + } + +@@ -156,8 +160,26 @@ sys_detect_dev_null_output (void) + && archive_stat.st_ino == dev_null_stat.st_ino)); + } + ++/* Manage to fully drain a pipe we might be reading, so to not break it on ++ the producer after the EOF block. FIXME: one of these days, GNU tar ++ might become clever enough to just stop working, once there is no more ++ work to do, we might have to revise this area in such time. */ ++ ++void ++sys_drain_input_pipe (void) ++{ ++ size_t r; ++ ++ if (access_mode == ACCESS_READ ++ && ! _isrmt (archive) ++ && (S_ISFIFO (archive_stat.st_mode) || S_ISSOCK (archive_stat.st_mode))) ++ while ((r = rmtread (archive, record_start->buffer, record_size)) != 0 ++ && r != SAFE_READ_ERROR) ++ continue; ++} ++ + void +-sys_wait_for_child (pid_t child_pid, bool eof) ++sys_wait_for_child (pid_t child_pid) + { + if (child_pid) + { +@@ -171,11 +193,8 @@ sys_wait_for_child (pid_t child_pid, bool eof) + } + + if (WIFSIGNALED (wait_status)) +- { +- int sig = WTERMSIG (wait_status); +- if (!(!eof && sig == SIGPIPE)) +- ERROR ((0, 0, _("Child died with signal %d"), sig)); +- } ++ ERROR ((0, 0, _("Child died with signal %d"), ++ WTERMSIG (wait_status))); + else if (WEXITSTATUS (wait_status) != 0) + ERROR ((0, 0, _("Child returned status %d"), + WEXITSTATUS (wait_status))); diff --git a/app-arch/tar/tar-1.21-r1.ebuild b/app-arch/tar/tar-1.21-r1.ebuild new file mode 100644 index 000000000000..2732d023a371 --- /dev/null +++ b/app-arch/tar/tar-1.21-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.21-r1.ebuild,v 1.1 2008/12/29 10:03:44 vapier Exp $ + +inherit flag-o-matic eutils + +DESCRIPTION="Use this to make tarballs :)" +HOMEPAGE="http://www.gnu.org/software/tar/" +SRC_URI="http://ftp.gnu.org/gnu/tar/${P}.tar.bz2 + ftp://alpha.gnu.org/gnu/tar/${P}.tar.bz2 + mirror://gnu/tar/${P}.tar.bz2" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="nls static userland_GNU" + +RDEPEND="" +DEPEND="${RDEPEND} + nls? ( >=sys-devel/gettext-0.10.35 )" + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}"/${P}-revert-pipe.patch #252680 + + if ! use userland_GNU ; then + sed -i \ + -e 's:/backup\.sh:/gbackup.sh:' \ + scripts/{backup,dump-remind,restore}.in \ + || die "sed non-GNU" + fi +} + +src_compile() { + local myconf + use static && append-ldflags -static + use userland_GNU || myconf="--program-prefix=g" + # Work around bug in sandbox #67051 + gl_cv_func_chown_follows_symlink=yes \ + econf \ + --enable-backup-scripts \ + --bindir=/bin \ + --libexecdir=/usr/sbin \ + $(use_enable nls) \ + ${myconf} || die + emake || die "emake failed" +} + +src_install() { + local p="" + use userland_GNU || p=g + + emake DESTDIR="${D}" install || die "make install failed" + + if [[ -z ${p} ]] ; then + # a nasty yet required piece of baggage + exeinto /etc + doexe "${FILESDIR}"/rmt || die + fi + + dodoc AUTHORS ChangeLog* NEWS README* PORTS THANKS + newman "${FILESDIR}"/tar.1 ${p}tar.1 + mv "${D}"/usr/sbin/${p}backup{,-tar} + mv "${D}"/usr/sbin/${p}restore{,-tar} + + rm -f "${D}"/usr/$(get_libdir)/charset.alias +} |