BSD's head command doesn't support -c-42888. But, the latest portage uses it. https://github.com/gentoo/portage/blob/master/pym/_emerge/BinpkgExtractorAsync.py#L80 # head -c-42888 /usr/portage/packages/sys-apps/portage-2.3.13.tbz2 head: illegal byte count -- -42888 Reproducible: Always Steps to Reproduce: 1. emerge -B portage && emerge -K portage 2. 3. Actual Results: >>> Emerging binary (1 of 1) sys-apps/portage-2.3.13::gentoo * portage-2.3.13.tbz2 MD5 SHA1 size ;-) ... [ ok ] >>> Extracting info >>> Extracting sys-apps/portage-2.3.13 head: illegal byte count -- -42888 bzip2: Compressed file ends unexpectedly; perhaps it is corrupted? *Possible* reason follows. bzip2: Inappropriate ioctl for device Input file = (stdin), output file = (stdout) It is possible that the compressed file(s) have become corrupted. You can use the -tvv option to test integrity of such files. You can use the `bzip2recover' program to attempt to recover data from undamaged sections of corrupted files. command 'head -c-42888 -- /usr/portage/packages/sys-apps/portage-2.3.13.tbz2' failed with status 1 !!! Error Extracting '/usr/portage/packages/sys-apps/portage-2.3.13.tbz2' >>> Failed to emerge sys-apps/portage-2.3.13, Log file: >>> '/var/tmp/portage/sys-apps/portage-2.3.13/temp/build.log' * * The following package has failed to build, install, or execute postinst: * * (sys-apps/portage-2.3.13:0/0::gentoo, binary scheduled for merge), Log file: * '/var/tmp/portage/sys-apps/portage-2.3.13/temp/build.log' *
This should fix it: https://patch-diff.githubusercontent.com/raw/gentoo/portage/pull/231.patch If you save the patch in /etc/portage/patches/sys-apps/portage/ then it will be applied automatically when you emerge portage.
(In reply to Zac Medico from comment #1) > This should fix it: > > https://patch-diff.githubusercontent.com/raw/gentoo/portage/pull/231.patch > > If you save the patch in /etc/portage/patches/sys-apps/portage/ then it will > be applied automatically when you emerge portage. I've confirmed that this bug have been fixed by applying your patch. Thanks! # emerge -K portage >>> Emerging binary (1 of 1) sys-apps/portage-2.3.13::gentoo * portage-2.3.13.tbz2 MD5 SHA1 size ;-) ... [ ok ] >>> Extracting info >>> Extracting sys-apps/portage-2.3.13 >>> Installing (1 of 1) sys-apps/portage-2.3.13::gentoo
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=4a0421e1768dccafd4f9edb77f61cc186afb18d3 commit 4a0421e1768dccafd4f9edb77f61cc186afb18d3 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2017-12-10 00:29:27 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2017-12-10 00:41:21 +0000 BinpkgExtractorAsync: use posix compatible head arguments (bug 640450) Fixes: b4b0e6b0aaa1 ("BinpkgExtractorAsync: remove trailer when decompressing binary packages") Bug: https://bugs.gentoo.org/640450 pym/_emerge/BinpkgExtractorAsync.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)}
(In reply to Yuta SATOH from comment #2) > I've confirmed that this bug have been fixed by applying your patch. > Thanks! Great! Thanks for testing!