diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-23 17:57:48 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-23 17:57:48 -0700 |
commit | 0ab6f83070c9a32a24454053319c99559c2654ca (patch) | |
tree | 02691a5ce6da1bfeb67761571f46c47e2b4161a1 /pym | |
parent | 3359e0116b4e592b28ac0f24fed6a1e2eabe6bf6 (diff) | |
download | portage-0ab6f83070c9a32a24454053319c99559c2654ca.tar.gz portage-0ab6f83070c9a32a24454053319c99559c2654ca.tar.bz2 portage-0ab6f83070c9a32a24454053319c99559c2654ca.zip |
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.
Diffstat (limited to 'pym')
-rw-r--r-- | pym/_emerge/BinpkgExtractorAsync.py | 4 |
1 files changed, 3 insertions, 1 deletions
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 ; " + \ |