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

Bug 350285

Summary: sys-apps/portage-2.1.9.25: depclean removes stable slots instead of higher-versioned unstable slots
Product: Gentoo Linux Reporter: Kevin Lyles <kevinlyles>
Component: [OLD] Core systemAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: floppym
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 349307, 351828    
Attachments: fix depclean to account for more masks
debug log from depclean
fix depclean more

Description Kevin Lyles 2011-01-01 15:05:37 UTC
This is a bit complex, but I'll do my best to explain it.  If you have a multi-slot package (I noticed it on python) with version x stable, and you install version x+1 (~arch) in a different slot, emerge --depclean will attempt to remove version x, even if version x+1 is NOT (no longer is, never was, etc.) keyworded on your system.  This results in a vicious cycle, with updating world pulling in the stable version to satisfy dependencies, and depclean trying to get rid of it again.

Reproducible: Always

Steps to Reproduce:
A currently relevant example:

1. Keyword and install python-2.7* (with python-2.6* already installed)
2. Un-keyword python-2.7*
3. Update world
4. Run emerge --depclean

Actual Results:  
Depclean tries to remove python-2.6*.
The next update world will bring it back in.

Expected Results:  
Depclean removes the non-keyworded version(s) of python (2.7* in this case).

I will happily supply any information requested; I'm skipping emerge --info for now because I don't think it will be helpful for this bug.  Let me know if I'm wrong about that.
Comment 1 Zac Medico gentoo-dev 2011-01-02 09:06:10 UTC
Maybe it's the same as bug 332719, which is supposed to be fixed in portage-2.1.9.x. Can you reproduce it with portage-2.1.9.x?
Comment 2 Zac Medico gentoo-dev 2011-01-02 09:54:53 UTC
Created attachment 258608 [details, diff]
fix depclean to account for more masks

Save as /tmp/depclean.patch, and apply as follows:

 patch /usr/lib/portage/pym/_emerge/depgraph.py /tmp/depclean.patch
Comment 3 Kevin Lyles 2011-01-02 12:59:56 UTC
(In reply to comment #1)
> Maybe it's the same as bug 332719, which is supposed to be fixed in
> portage-2.1.9.x. Can you reproduce it with portage-2.1.9.x?

I originally noticed the bug with 2.1.9.25.  I can test a newer 2.1.9.x version if you'd like, just let me know which one.

(In reply to comment #2)
> Created an attachment (id=258608) [details]
> fix depclean to account for more masks
> 
> Save as /tmp/depclean.patch, and apply as follows:
> 
>  patch /usr/lib/portage/pym/_emerge/depgraph.py /tmp/depclean.patch

This appears to partially fix the issue, at least for python as mentioned above.  With the patch, no version is removed by depclean, so the vicious cycle problem is fixed.  However, an ideal solution would remove the un-keyworded version, since nothing actually depends on it.
Comment 4 Zac Medico gentoo-dev 2011-01-02 20:20:02 UTC
(In reply to comment #3)
> However, an ideal solution would remove the un-keyworded
> version, since nothing actually depends on it.

Well, it got pulled in somehow. Maybe this will show reverse dependencies:

   emerge -pv --depclean python:2.7

If that doesn't show anything, please post debug output for a full depclean:

   emerge -pv --debug --depclean &> debug.log
Comment 5 Kevin Lyles 2011-01-02 20:50:59 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > However, an ideal solution would remove the un-keyworded
> > version, since nothing actually depends on it.
> 
> Well, it got pulled in somehow. Maybe this will show reverse dependencies:
> 
>    emerge -pv --depclean python:2.7
> 
> If that doesn't show anything, please post debug output for a full depclean:
> 
>    emerge -pv --debug --depclean &> debug.log


It got pulled in the first time by me keywording it to try a package that needed 2.7 (I discovered the problem when I un-keyworded it), and this last time by me running:
ACCEPT_KEYWORDS="~x86" emerge -av1 =python-2.7*
to test the issue. :P

Running depclean on python-2.7 specifically shows reverse dependencies, but all of those are also satisfied by python-2.6.

I'll attach the debug output shortly.
Comment 6 Kevin Lyles 2011-01-02 20:52:32 UTC
Created attachment 258670 [details]
debug log from depclean
Comment 7 Zac Medico gentoo-dev 2011-01-02 21:14:06 UTC
Created attachment 258671 [details, diff]
fix depclean more

Hopefully it's all fixed, with this patch applied in addition to the previous patch.
Comment 8 Kevin Lyles 2011-01-02 21:37:09 UTC
(In reply to comment #7)
> Created an attachment (id=258671) [details]
> fix depclean more
> 
> Hopefully it's all fixed, with this patch applied in addition to the previous
> patch.
> 

That appears to have done the trick.  Thank you!
Comment 9 Zac Medico gentoo-dev 2011-01-02 21:42:11 UTC
Great, thanks for testing!