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

Bug 635678

Summary: app-eselect/eselect-python: dangling entries in python-exec.conf upon python removal
Product: Gentoo Linux Reporter: Oleh <moonlapse81>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED FIXED    
Severity: normal CC: Ikonta, luke, mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 653328    
Bug Blocks:    

Description Oleh 2017-10-28 12:19:50 UTC
With multiple pythons versions installed, removing of certain version leaves it present in eselect python list and in /etc/python-exec/python-exec.conf. Moreover it can be selected as active even the version is not present on box.

Reproducible: Always




w520 / # eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.6
  [2]   python3.4
  [3]   python2.7
w520 / #

w520 / # cat /etc/python-exec/python-exec.conf (clipped)
...
python3.6
python3.4
python2.7

w520 / # ls -l /var/db/pkg/dev-lang (clipped)
drwxr-xr-x 2 root root 4096 Oct 20 17:16 python-2.7.13
drwxr-xr-x 2 root root 4096 Oct 28 15:09 python-3.4.6
drwxr-xr-x 2 root root 4096 Oct 20 17:18 python-3.6.1-r1
drwxr-xr-x 2 root root 4096 Apr  5  2017 python-exec-2.4.5

w520 / # emerge -C python:3.4
 * This action can remove important packages! In order to be safer, use
 * `emerge -pv --depclean <atom>` to check for reverse dependencies before
 * removing packages.

 dev-lang/python
    selected: 3.4.6 
   protected: none 
     omitted: 2.7.13 3.6.1-r1
After removal of pytohn:3.4:

w520 / # eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.6
  [2]   python3.4
  [3]   python2.7
w520 / #

Same with python-exec.conf entries, all three versions are present. I can select non-existent python:

w520 / # eselect python set 2
w520 / # eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.4
  [2]   python3.6
  [3]   python2.7
w520 / #
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-10-28 13:11:13 UTC
I see two things to potentially fix here:

1. We should mark the entries for uninstalled Pythons appropriately to reduce confusion.

2. It may be reasonable to remove old entries from python.exec in pkg_postrm() when the last version in slot is removed.

Comments?
Comment 2 Oleh 2017-10-28 17:15:08 UTC
i prefer #2 (or any viable way which does the same) as this eliminate any possible confusion with pythons entries. No python:slot exist on box -no eselect entries should be on the box too.
Comment 3 Mike Gilbert gentoo-dev 2017-10-28 17:52:11 UTC
I would prefer not to mess with the config file in pkg_* functions. We should treat it like a typical config file whenever possible, and let the sysadmin maintain its contents.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-12-03 13:27:40 UTC
https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=a818ba77f72aff31d82badf7cb9b4cbd50cdbdf2

Added a new 'cleanup' action there. I will do a new release later, then we'll decide whether we want to run by default.
Comment 5 Larry the Git Cow gentoo-dev 2017-12-04 17:47:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74abdf6f536ff8713ebb520db2e484808c7c041b

commit 74abdf6f536ff8713ebb520db2e484808c7c041b
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2017-12-04 17:44:14 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2017-12-04 17:47:30 +0000

    app-eselect/eselect-python: Bump to 20171204
    
    Bug: https://bugs.gentoo.org/635678
    Closes: https://bugs.gentoo.org/639578

 app-eselect/eselect-python/Manifest                |  1 +
 .../eselect-python/eselect-python-20171204.ebuild  | 40 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)}
Comment 6 Morgan Wesström 2017-12-11 18:46:41 UTC
I experienced the same problem after upgrading to dev-lang/python:3.5 and it was resolved by the updated app-eselect/eselect-python. However, I still have another file referencing the old removed Python 3.4

# cat /etc/env.d/python/config 
python3.4

What do I do with this?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-12-11 20:30:35 UTC
I think those we should remove in postinst() when upgrading. @floppym, your opinion?
Comment 8 Mike Gilbert gentoo-dev 2017-12-11 20:44:17 UTC
(In reply to Michał Górny from comment #7)

/etc/env.d/python/config doesn't get used in any of our tools, right? Cleaning it up seems ok, but ultimately unnecessary.