diff options
author | Zac Medico <zmedico@gentoo.org> | 2017-10-03 23:07:05 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-10-04 00:07:32 -0700 |
commit | 26c0a0e31b5150f7ef23b2156b87863e47dd5996 (patch) | |
tree | 2734d2d71144dedfbef2b9e2ee198e8fe319a2d8 | |
parent | BinpkgExtractorAsync: remove trailer when decompressing binary packages (diff) | |
download | portage-26c0a0e31b5150f7ef23b2156b87863e47dd5996.tar.gz portage-26c0a0e31b5150f7ef23b2156b87863e47dd5996.tar.bz2 portage-26c0a0e31b5150f7ef23b2156b87863e47dd5996.zip |
BinpkgExtractorAsync: fix PIPESTATUS error handling
Fixes: b4b0e6b0aaa1 ("remove trailer when decompressing binary packages")
-rw-r--r-- | pym/_emerge/BinpkgExtractorAsync.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py index 173845974..07ba2a1b7 100644 --- a/pym/_emerge/BinpkgExtractorAsync.py +++ b/pym/_emerge/BinpkgExtractorAsync.py @@ -80,17 +80,21 @@ class BinpkgExtractorAsync(SpawnProcess): # SIGPIPE handling (128 + SIGPIPE) should be compatible with # assert_sigpipe_ok() that's used by the ebuild unpack() helper. self.args = [self._shell_binary, "-c", - ("head -c-%d -- %s | %s | tar -xp %s -C %s -f - ; " + \ - "p=(${PIPESTATUS[@]}) ; " + \ - "if [[ ${p[0]} != 0 && ${p[0]} != %d ]] ; then " % (128 + signal.SIGPIPE) + \ - "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 ; " + \ + ("cmd0=(head -c-%d -- %s) cmd1=(%s) cmd2=(tar -xp %s -C %s -f -); " + \ + '"${cmd0[@]}" | "${cmd1[@]}" | "${cmd2[@]}"; ' + \ + "p=(${PIPESTATUS[@]}) ; for i in {0..2}; do " + \ + "if [[ ${p[$i]} != 0 && ${p[$i]} != %d ]] ; then " + \ + "echo command $(eval \"echo \\\"'\\${cmd$i[*]}'\\\"\") " + \ + "failed with status ${p[$i]} ; exit ${p[$i]} ; fi ; done; " + \ + "if [ ${p[$i]} != 0 ] ; then " + \ + "echo command $(eval \"echo \\\"'\\${cmd$i[*]}'\\\"\") " + \ + "failed with status ${p[$i]} ; exit ${p[$i]} ; fi ; " + \ "exit 0 ;") % \ (pkg_xpak.xpaksize, portage._shell_quote(self.pkg_path), decomp_cmd, tar_options, - portage._shell_quote(self.image_dir))] + portage._shell_quote(self.image_dir), + 128 + signal.SIGPIPE)] SpawnProcess._start(self) |