commit:     b4b0e6b0aaa1feb405823277b82ebb2e4820e0b8
Author:     Matija Skala <mskala <AT> gmx <DOT> com>
AuthorDate: Wed Sep 27 22:40:25 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct  4 01:30:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4b0e6b0

BinpkgExtractorAsync: remove trailer when decompressing binary packages

xz and zstd don't support trailing data
and fail upon encountering xpak trailer

Bug: 630132
Closes: https://github.com/gentoo/portage/pull/210

 pym/_emerge/BinpkgExtractorAsync.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/BinpkgExtractorAsync.py 
b/pym/_emerge/BinpkgExtractorAsync.py
index e85f4ecac..173845974 100644
--- a/pym/_emerge/BinpkgExtractorAsync.py
+++ b/pym/_emerge/BinpkgExtractorAsync.py
@@ -74,20 +74,22 @@ class BinpkgExtractorAsync(SpawnProcess):
                                self._async_wait()
                                return
 
-               # Add -q to decomp_cmd opts, in order to avoid "trailing garbage
-               # after EOF ignored" warning messages due to xpak trailer.
+               pkg_xpak = portage.xpak.tbz2(self.pkg_path)
+               pkg_xpak.scan()
+
                # 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",
-                       ("%s -cq -- %s | tar -xp %s -C %s -f - ; " + \
+                       ("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 ; " + \
                        "exit 0 ;") % \
-                       (decomp_cmd,
+                       (pkg_xpak.xpaksize,
                        portage._shell_quote(self.pkg_path),
+                       decomp_cmd,
                        tar_options,
                        portage._shell_quote(self.image_dir))]
 

Reply via email to