Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 583986

Summary: sys-apps/portage: qcheck =dev-lang/ghc-7.10.3 reports multiple missing files in /usr/lib64/ghc-7.8.4/
Product: Gentoo Linux Reporter: Coacher <itumaykin+gentoo>
Component: [OLD] DevelopmentAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: haskell
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 193766    
Attachments: emerge --info ghc
equery files ghc
/var/db/pkg/dev-lang/ghc-7.10.3/CONTENTS
/var/db/pkg/dev-haskell/json-0.9.1/CONTENTS
repo.zip

Description Coacher 2016-05-24 14:38:30 UTC
Created attachment 435256 [details]
emerge --info ghc

Hello.

Here's the qcheck output on my machine:

$ qcheck ghc
Checking dev-lang/ghc-7.10.3 ...
 MD5-DIGEST: /usr/lib64/ghc-7.10.3/package.conf.d/package.cache
 AFK: /usr/lib64/ghc-7.8.4/array-0.5.0.0
 AFK: /usr/lib64/ghc-7.8.4/base-4.7.0.2
 AFK: /usr/lib64/ghc-7.8.4/binary-0.7.1.0
 AFK: /usr/lib64/ghc-7.8.4/bytestring-0.10.4.0
 AFK: /usr/lib64/ghc-7.8.4/containers-0.5.5.1
 AFK: /usr/lib64/ghc-7.8.4/deepseq-1.3.0.2
 AFK: /usr/lib64/ghc-7.8.4/directory-1.2.1.0
 AFK: /usr/lib64/ghc-7.8.4/filepath-1.3.0.2
 AFK: /usr/lib64/ghc-7.8.4/ghc-prim-0.3.1.0
 AFK: /usr/lib64/ghc-7.8.4/integer-gmp-0.5.1.0
 AFK: /usr/lib64/ghc-7.8.4/old-locale-1.0.0.6
 AFK: /usr/lib64/ghc-7.8.4/pretty-1.1.1.1
 AFK: /usr/lib64/ghc-7.8.4/process-1.2.0.0
 AFK: /usr/lib64/ghc-7.8.4/template-haskell-2.9.0.0
 AFK: /usr/lib64/ghc-7.8.4/time-1.4.2
 AFK: /usr/lib64/ghc-7.8.4/unix-2.7.0.1
  * 5697 out of 5714 files are good

I've run all the rebuilds after ghc update. @preserved-rebuild and revdep-rebuild are both clean.

The similar problem affects multiple Haskell packages installed on my machine:

dev-haskell/json-0.9.1
dev-haskell/mtl-2.2.1-r1
dev-haskell/parsec-3.1.9-r1
dev-haskell/primitive-0.5.1.0
dev-haskell/quickcheck-2.8.1
dev-haskell/random-1.0.1.1-r1
dev-haskell/regex-base-0.93.2-r1
dev-haskell/regex-tdfa-1.2.0
dev-haskell/text-1.2.2.1
dev-haskell/tf-random-0.5
dev-haskell/transformers-0.4.3.0

The problem is again missing files in /usr/lib64/ghc-7.8.4/.

Please fix.
Comment 1 Coacher 2016-05-24 14:40:07 UTC
Created attachment 435260 [details]
equery files ghc
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2016-05-25 20:41:06 UTC
Please describe what exactly you did with files on your filesystem
around package manager.

Especially /usr/lib64/ghc-7.8.4/ contents. It looks like you've
manually wiped out files preserved by portage.

And please post contents of
    /var/db/pkg/dev-lang/ghc-7.10.3/CONTENTS
and other packages that are affected.
Comment 3 Coacher 2016-05-25 20:55:52 UTC
Created attachment 435374 [details]
/var/db/pkg/dev-lang/ghc-7.10.3/CONTENTS

I didn't do any manual operations with the haskell toolchain or packages.
They are only updated via portage on my machine.

$ ls -laR /usr/lib64/ghc-7.8.4/
/usr/lib64/ghc-7.8.4/:
total 144
drwxr-xr-x   3 root root   4096 May 16 00:37 ./
drwxr-xr-x 118 root root 135168 May 25 16:05 ../
drwxr-xr-x   2 root root   4096 May 16 00:37 gentoo/

/usr/lib64/ghc-7.8.4/gentoo:
total 8
drwxr-xr-x 2 root root 4096 May 16 00:37 ./
drwxr-xr-x 3 root root 4096 May 16 00:37 ../
-rw-r--r-- 1 root root    0 Aug 18  2015 haskell-updater-1.2.9.conf
Comment 4 Coacher 2016-05-25 21:01:53 UTC
Created attachment 435376 [details]
/var/db/pkg/dev-haskell/json-0.9.1/CONTENTS

Here's CONTENTS from one of the affected haskell packages.
There are about ten of them if you need those too I'll attach them.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2016-05-25 21:08:16 UTC
(In reply to Coacher from comment #3)
> Created attachment 435374 [details]
> /var/db/pkg/dev-lang/ghc-7.10.3/CONTENTS

+dev-portage

Interesting. I think it's a portage bug of not cleaning up CONTENTS
files when @preserved-rebuild deleted empty directories with unused
SOLIBs.

My speculation of seqence of actions is:
1. dev-lang/ghc-7.8.4 gets installed onto the system and installs dynamic libraries
   in non-standard directoryies
    /usr/lib64/ghc-7.8.4/array-0.5.0.0/array.so # the real hames are a bit longer
    /usr/lib64/ghc-7.8.4/base-4.7.0.2/base.so
2. dev-haskell/transformers-0.4.3.0 gets installed and links against those libraries
3. dev-lang/ghc-7.10.3 gets installed but preserved-libs attributes
   7.8.4 libraries to new package
4. emerge @preserved-rebuild rebuilds dev-haskell/transformers-0.4.3.0
   and relinks it against /usr/lib64/ghc-7.10.3/array-0.6.0.0/array.so
5. portage tries to cleanup /usr/lib64/ghc-7.8.4/array-0.5.0.0/array.so
   from preserved libs, deletes empty directory /usr/lib64/ghc-7.8.4/
   but does not emove (now empty) directory from CONTENTS.

We get corrupted CONTENTS.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2016-05-25 21:09:24 UTC
(In reply to Coacher from comment #4)
> Created attachment 435376 [details]
> /var/db/pkg/dev-haskell/json-0.9.1/CONTENTS
> 
> Here's CONTENTS from one of the affected haskell packages.
> There are about ten of them if you need those too I'll attach them.

This should be enough. It exibits the same problem as with ghc.
Thanks!
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2016-05-25 21:12:04 UTC
+Zac as he might know more than others about @preserved-libs :)
Comment 8 Zac Medico gentoo-dev 2016-05-25 21:37:25 UTC
(In reply to Sergei Trofimovich from comment #5)
> 5. portage tries to cleanup /usr/lib64/ghc-7.8.4/array-0.5.0.0/array.so
>    from preserved libs, deletes empty directory /usr/lib64/ghc-7.8.4/
>    but does not emove (now empty) directory from CONTENTS.
> 
> We get corrupted CONTENTS.

Yeah, that makes sense, because the vardbapi.removeFromContents method is responsible and it makes no attempt to remove empty directories from CONTENTS.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2016-05-26 07:37:51 UTC
I've built a small repo-reroducer:
    https://github.com/trofi/portage-bug-583986-repo

You need to merge an =app/app-0 with and without USE=lib1 in any order.
It triggers the same behaviour:

::

    sudo ACCEPT_KEYWORDS='**' PORTDIR_OVERLAY=. USE=-lib1 emerge -v1 app/app
    sudo ACCEPT_KEYWORDS='**' PORTDIR_OVERLAY=. USE=lib1  emerge -v1 app/app
    qcheck lib/lib

We get the output as:

::

    >>> Emerging (1 of 2) lib/lib-1::portage-bug-583986-repo
    >>> Installing (1 of 2) lib/lib-1::portage-bug-583986-repo
    >>> Emerging (2 of 2) app/app-0::portage-bug-583986-repo
    >>> Installing (2 of 2) app/app-0::portage-bug-583986-repo
    
    Checking lib/lib-1 ...
     AFK: /usr/lib/lib-2
      * 9 out of 10 files are good
Comment 10 Sergei Trofimovich 2022-06-24 11:44:01 UTC
Created attachment 787346 [details]
repo.zip

Uploading repository as it's about to disappear.