Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 520112 - emerge ignores original root for slot rebuilds
Summary: emerge ignores original root for slot rebuilds
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: PATCH
Depends on: 883437
Blocks: 137867
  Show dependency tree
 
Reported: 2014-08-17 05:13 UTC by mike@marineau.org
Modified: 2022-12-10 00:23 UTC (History)
2 users (show)

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


Attachments
root.patch (root.patch,932 bytes, patch)
2014-08-17 05:13 UTC, mike@marineau.org
Details | Diff
catalyst test configs and logs (catalyst.tar.gz,177.31 KB, application/gzip)
2014-08-17 05:14 UTC, mike@marineau.org
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mike@marineau.org 2014-08-17 05:13:32 UTC
Created attachment 383018 [details, diff]
root.patch

Packages being re-installed via @__auto_slot_operator_replace_installed__ always get installed into the target $ROOT, not the root the packages are currently installed in. This is a pretty weird corner case to hit but here is one concrete example to do it, I used catalyst and portage 2.2.12 but neither are strictly required.

Starting from a stage3 and default/linux/amd64/13.0 profile, add xattr to use.force, mask >=dev-lang/python-exec-2 and optionally keyword portage 2.2.12. The current stable should do the same. Re-install portage and install gentoolkit. This will add the following:

dev-lang/python-exec-0.3.1-r1
sys-apps/install-xattr-0.3
dev-python/setuptools-2.2
dev-python/pyxattr-0.5.2
sys-apps/portage-2.2.12
app-portage/gentoolkit-0.3.0.8-r2

Now unmask dev-lang/python-exec and build a stage1, in addition to the usual bootstrap package list the following get built:

dev-lang/python-exec-2.0.1-r1 to /
dev-python/setuptools-2.2 to /
app-portage/gentoolkit-0.3.0.8-r2 to /tmp/stage1root/
dev-python/setuptools-2.2 to /tmp/stage1root/

The big fat WTF is gentoolkit magically getting pulled into stage1! It shouldn't need the extra setuptools either but it's gentoolkit that causes the build to fail do to needing USE=xml which isn't enabled in stage1.

I've spent a day going through the portage code and still only barely make sense of it but the basic issue is _resolve() in depgraph.py ignores the root config in the *Arg objects. Attached is a simple patch to fix that but I'm not sure if there is anything else fishy going on here or if this is the complete and proper fix.
Comment 1 mike@marineau.org 2014-08-17 05:14:53 UTC
Created attachment 383020 [details]
catalyst test configs and logs

The attached tarball includes my catalyst configs and emerge debug logs.
Comment 2 Brian Dolbec (RETIRED) gentoo-dev 2014-08-17 15:20:10 UTC
If I am following this correctly...

You are using a custom stage4 with some additional pkgs installed and using that for the catalyst chroot stage1 creation.

If that is the case, then portage should not be rebuilding anything in the chroot system.  Aside from the portage update (always done) and gcc update (if you set: "update_seed: yes" stage1.spec) performed on the chroot system.  It is building the pkgs for an alternate (target) root, not the base system.  So there should not be any rebuilds for base system pkgs being built in the target system.

It must be the portage update in the base chroot that is causing the gentolkit rebuild.  But... gentoolkit is then getting rebuilt into the target stage1 root instead of the base chroot system?

So why is gentoolkit getting pulled into a later separate and different emerge command??????
Comment 3 mike@marineau.org 2014-08-17 18:27:32 UTC
The --root-deps option isn't used so buildtime dependencies are being installed to / while run time dependencies land in $ROOT. So it could be legitimate to install the new python-exec:2 slot in / as a buildtime dependency of pyxattr. In turn that upgrade from python-exec:0 to python-exec:2 in / can trigger slot-operator based rebuilds in /, including gentoolkit. The issue is that these triggered rebuilds then slide over from / into the new $ROOT instead. Here are the relevant bits from stage1.log in the tarball I posted, the mixup happens towards the end where @__auto_slot_operator_replace_installed__ is being processed.


slot_operator_update_probe:
   existing child package:  (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed)
   existing parent package: (dev-python/setuptools-2.2:0/0::gentoo, installed)
   new child package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   new parent package: (dev-python/setuptools-2.2:0/0::gentoo, ebuild scheduled for merge)


backtracking due to missed slot abi update:
   child package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   new child slot package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   parent package: (dev-python/setuptools-2.2:0/0::gentoo, installed)
   atom: dev-lang/python-exec:0/0=[python_targets_python2_7(-),python_targets_python3_3(-),-python_single_target_python2_7(-),-python_single_target_python3_2(-),-python_single_target_python3_3(-),-python_single_target_python3_4(-),-python_single_target_pypy(-)]


slot_operator_update_probe:
   existing child package:  (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed)
   existing parent package: (dev-python/pyxattr-0.5.2:0/0::gentoo, installed)
   new child package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   new parent package: (dev-python/pyxattr-0.5.2:0/0::gentoo, ebuild scheduled for merge)


backtracking due to missed slot abi update:
   child package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   new child slot package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   parent package: (dev-python/pyxattr-0.5.2:0/0::gentoo, installed)
   atom: dev-lang/python-exec:0/0=[python_targets_python2_7(-),python_targets_python3_3(-),-python_single_target_python2_7(-),-python_single_target_python3_2(-),-python_single_target_python3_3(-),-python_single_target_pypy(-)]


slot_operator_update_probe:
   existing child package:  (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed)
   existing parent package: (app-portage/gentoolkit-0.3.0.8-r2:0/0::gentoo, installed)
   new child package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   new parent package: (app-portage/gentoolkit-0.3.0.8-r2:0/0::gentoo, ebuild scheduled for merge)


backtracking due to missed slot abi update:
   child package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   new child slot package:  (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge)
   parent package: (app-portage/gentoolkit-0.3.0.8-r2:0/0::gentoo, installed)
   atom: dev-lang/python-exec:0/0=[python_targets_python2_7(-),python_targets_python3_3(-),-python_single_target_python2_7(-),-python_single_target_python3_2(-),-python_single_target_python3_3(-)]


...

backtracking try 1

forced reinstall atoms:


slot operator dependencies:
...
   (/, dev-lang/python-exec:0)
      parent: (dev-python/pyxattr-0.5.2:0/0::gentoo, ebuild scheduled for merge to '/tmp/stage1root/')
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (buildtime_slot_op)
      parent: (dev-python/setuptools-2.2:0/0::gentoo, installed)
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (runtime_slot_op)
      parent: (dev-python/setuptools-2.2:0/0::gentoo, installed)
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (runtime_slot_op)
      parent: (dev-python/pyxattr-0.5.2:0/0::gentoo, installed)
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (runtime_slot_op)
      parent: (dev-python/pyxattr-0.5.2:0/0::gentoo, installed)
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (runtime_slot_op)
      parent: (app-portage/gentoolkit-0.3.0.8-r2:0/0::gentoo, installed)
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (runtime_slot_op)
      parent: (app-portage/gentoolkit-0.3.0.8-r2:0/0::gentoo, installed)
        child: (dev-lang/python-exec-0.3.1-r1:0/0::gentoo, installed) (runtime_slot_op)
   (/tmp/stage1root/, dev-lang/python-exec:2)
      parent: (dev-python/pyxattr-0.5.2:0/0::gentoo, ebuild scheduled for merge to '/tmp/stage1root/')
        child: (dev-lang/python-exec-2.0.1-r1:2/2::gentoo, ebuild scheduled for merge to '/tmp/stage1root/') (runtime_slot_op)

...

      Arg: @__auto_slot_operator_replace_installed__
     Atom: dev-python/pyxattr:0
   ebuild: dev-python/pyxattr-0.5.2::gentoo

Child:         (dev-python/pyxattr-0.5.2:0/0::gentoo, ebuild scheduled for merge to '/tmp/stage1root/') USE="-test" ABI_X86="64" PYTHON_TARGETS="python2_7 python3_3 -pypy -python3_2"
Parent Dep:    dev-python/pyxattr:0 required by @__auto_slot_operator_replace_installed__

      Arg: @__auto_slot_operator_replace_installed__
     Atom: app-portage/gentoolkit:0
   ebuild: app-portage/gentoolkit-0.3.0.8-r2::gentoo

Child:         (app-portage/gentoolkit-0.3.0.8-r2:0/0::gentoo, ebuild scheduled for merge to '/tmp/stage1root/') USE="" ABI_X86="64" PYTHON_TARGETS="python2_7 python3_3 -python3_2"
Parent Dep:    app-portage/gentoolkit:0 required by @__auto_slot_operator_replace_installed__

      Arg: @__auto_slot_operator_replace_installed__
     Atom: dev-python/setuptools:0
   ebuild: dev-python/setuptools-2.2::gentoo

Child:         (dev-python/setuptools-2.2:0/0::gentoo, ebuild scheduled for merge to '/tmp/stage1root/') USE="" ABI_X86="64" PYTHON_TARGETS="python2_7 python3_3 -pypy -python3_2 -python3_4"
Parent Dep:    dev-python/setuptools:0 required by @__auto_slot_operator_replace_installed__
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-10 00:17:29 UTC
Chewi fixed this recently:

commit fca3478de7127bbdf58c6f4b809c177662d5e4cb
Author: James Le Cuirot <chewi@gentoo.org>
Date:   Sun Nov 20 11:46:34 2022 +0000

    depgraph: Resolve atoms using the correct root

    This bug may have played out in different ways, but one example was a
    rebuild in / causing the same package to be added to ROOT, even when it
    had no other reason to be.

    Signed-off-by: James Le Cuirot <chewi@gentoo.org>
    Closes: https://github.com/gentoo/portage/pull/941
    Signed-off-by: Sam James <sam@gentoo.org>

(also, I'm sorry we missed the patch and didn't handle this before now.)
Comment 5 Larry the Git Cow gentoo-dev 2022-12-10 00:23:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=daf7c92e70806144160874ddd942a34ecd176570

commit daf7c92e70806144160874ddd942a34ecd176570
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-10 00:23:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-10 00:23:31 +0000

    NEWS: retroactively add bug reference for ROOT rebuild fix
    
    Bug: https://bugs.gentoo.org/520112
    Signed-off-by: Sam James <sam@gentoo.org>

 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)