From 0ab6f83070c9a32a24454053319c99559c2654ca Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 23 Aug 2010 17:57:48 -0700 Subject: Handle SIGPIPE when unpack() extracts tar files through a pipe (bug #309001). When checking ${PIPESTATUS[@]} for extraction of tar files in unpack(), use a new assert_sigpipe_ok() function which behaves the same as the existing assert() function except that it tolerates pipe writers being killed by SIGPIPE. --- pym/_emerge/BinpkgExtractorAsync.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pym') diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py index a4941fccf..3a2654ec1 100644 --- a/pym/_emerge/BinpkgExtractorAsync.py +++ b/pym/_emerge/BinpkgExtractorAsync.py @@ -12,10 +12,12 @@ class BinpkgExtractorAsync(SpawnProcess): _shell_binary = portage.const.BASH_BINARY def _start(self): + # SIGPIPE handling (status 141) should be compatible with + # assert_sigpipe_ok() that's used by the ebuild unpack() helper. self.args = [self._shell_binary, "-c", ("bzip2 -dqc -- %s | tar -xp -C %s -f - ; " + \ "p=(${PIPESTATUS[@]}) ; " + \ - "if [ ${p[0]} != 0 ] ; then " + \ + "if [[ ${p[0]} != 0 && ${p[0]} != 141 ]] ; then " + \ "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \ "if [ ${p[1]} != 0 ] ; then " + \ "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \ -- cgit v1.2.3-1-g7c22