Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 785637 - dev-lang/ghc-8.10.4 fails to emerge due to error in ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2
Summary: dev-lang/ghc-8.10.4 fails to emerge due to error in ghc-bin-8.10.4-x86_64-pc-...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-25 16:42 UTC by Paul Preney
Modified: 2021-04-25 20:59 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Preney 2021-04-25 16:42:51 UTC
dev-lang/ghc 8.10.4 won't emerge due to being unable to decompress ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 with pbzip2 which is demonstrated by:

    user@machine /tmp/bug $ cp /var/cache/distfiles/ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 .
    user@machine /tmp/bug $ pbzip2 -d ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 
    pbzip2: *ERROR during BZ2_bzDecompress - trailing garbage: ret=4; block=1; seq=0; isLastInSeq=1; avail_in=25876
    pbzip2: *ERROR: system call failed with errno=[2: No such file or directory]!
    pbzip2: *ERROR: system call failed with errno=[2: No such file or directory]!
    Terminator thread: premature exit requested - quitting...
    pbzip2:  *INFO: Deletion of output file succeeded.
    user@machione /tmp/bug $ echo $?
    1
    user@machione /tmp/bug $

and bzip2 *appears* to work since it returns 0 and a decompressed file --but it also notes there is trailing garbage, e.g.,

    user@machine /tmp/bug $ bzip2 -d ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 
    
    bzip2: ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2: trailing garbage after EOF ignored
    user@machine /tmp/bug $ echo $?
    0
    user@machine /tmp/bug $ ls -l ghc-bin*
    -rw------- 1 user user 957378560 Apr 25 12:29 ghc-bin-8.10.4-x86_64-pc-linux-gnu.tar
    user@machine /tmp/bug $

I discovered this when trying to emerge ghc and arrived at this issue since my /etc/portage/make.conf has in it:

    PORTAGE_BZIP2_COMMAND="/usr/bin/pbzip2"

Since bzip2 produces a decompressed file and the result allows dev-lang/ghc to be built, this issue can be worked-around for now by creating an env override for dev-lang/ghc as follows:

    echo 'PORTAGE_BZIP2_COMMAND="/bin/bzip2"' >> /etc/portage/env/no-portage-bzip2-command.conf
    echo 'dev-lang/ghc no-portage-bzip2-command.conf' >> /etc/portage/package.env/overrides.conf

and dev-lang/ghc will emerge. That said, the underlying problem appears to be the ghc-bin tarball.

Reproducible: Always

Steps to Reproduce:
1. Set PORTAGE_BZIP2_COMMAND="/usr/bin/pbzip2" in make.conf
2. Emerge dev-lang/ghc
Actual Results:  
The emerge of dev-lang/ghc will fail due to pbzip2 failing with a non-zero return value (of 1).

Expected Results:  
It was expected that dev-lang/ghc would emerge.

Users that have not set PORTAGE_BZIP2_COMMAND in make.conf will not see this problem (unless they carefully inspect build logs) as dev-lang/ghc will successfully emerge despite "trailing garbage after EOF ignored" still being produced by bzip2.
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-25 19:42:15 UTC
ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 is produced by emerge --buildpkg. It contains both normal .tar.bz2 contents and environment.

As you have discovered bzip2 skipped it forever. pzip2 does not. I'm not sure what is out of spec here. You might want to confirm with pbzip2 upstream.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-25 20:05:46 UTC
Also bug #320313 sounds vaguely familiar where pbzip2 was fixed at least once for similar issue.

CC +polynomial-c@ as a app-arch/pbzip2 maintainer.
Comment 3 Paul Preney 2021-04-25 20:29:30 UTC
Digging some more "man pbzip2" shows that pbzip2 has an option: "--ignore-trailing-garbage=#", i.e.., one wants the following set in /etc/make.conf:

    PORTAGE_BZIP2_COMMAND="/usr/bin/pbzip2 --ignore-trailing-garbage=1"

instead of:

    PORTAGE_BZIP2_COMMAND="/usr/bin/pbzip2"

to apparently have the same semantics as bzip2. (I confirm the above works to install dev-lang/ghc (after removing the env stuff of course).)

That said, it is a concern that the tarball has trailing garbage and I feel such should be fixed. In the dev-lang/ghc ebuild, this is set:

    arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"

which can end up in SRC_URI and downloaded and affect others, i.e., whatever is causing this tarball to have trailing garbage (reported both by bzip2 and pbzip2) needs to be discovered and fixed.

Since pbzip2 has the --ignore-trailing-garbage and when used matches bzip2 and both report the same trailing garbage issue I've not filed any bug reports upstream with either of those projects. (If others here feel otherwise, please say so and why.)

From my point-of-view, it appears the fixes needed are to address the causes of generating trailing garbage tarballs in the first place. :-)
Comment 4 Paul Preney 2021-04-25 20:59:26 UTC
I have FEATURES="buildpkg" set in my make.conf and manually decompressing the dev-lang/ghc .xpak file with bzip2 and pbzip2 both result in trailing garbage errors. With pbzip2 one has to use --ignore-trailing-garbage=1 to get the output (otherwise such is deleted). Other .xpak files also have the same issue: trailing garbage, e.g., 

    $ cp gcc-10.3.0-1.xpak gcc-10.3.0-1.xpak.tar.bz2
    $ pbzip2 -d gcc-10.3.0-1.xpak.tar.bz2 
pbzip2: *ERROR during BZ2_bzDecompress - trailing garbage: ret=4; block=271; seq=0; isLastInSeq=1; avail_in=17997
pbzip2: *ERROR: system call failed with errno=[2: No such file or directory]!
pbzip2: *ERROR: system call failed with errno=[2: No such file or directory]!
Terminator thread: premature exit requested - quitting...
pbzip2:  *INFO: Deletion of output file succeeded.
    $

so this is not a problem with dev-lang/ghc per se --it is connected to FEATURES=buildpkg and underlying tools.