[Bug 2015243] [NEW] py3versions doesn't follow symlinks (like realpath)
Kostiantyn Astakhov
2015243 at bugs.launchpad.net
Tue Apr 4 13:52:01 UTC 2023
Public bug reported:
In case if we have more than one python version and manage them by update-alternatives, the path to the python binary looks like:
root at devvm-14-143:~# ls -la /usr/bin/python3
lrwxrwxrwx 1 root root 25 Apr 4 08:11 /usr/bin/python3 -> /etc/alternatives/python3
root at devvm-14-143:~# ls -la /etc/alternatives/python3
lrwxrwxrwx 1 root root 18 Apr 4 08:11 /etc/alternatives/python3 -> /usr/bin/python3.8
So even we use the correct default version of python3 (like in Focal it
is python3.8) py3version will fail
root at devvm-14-143:~# py3versions -d
py3versions: the symlink /usr/bin/python3 does not point to the python3 default version. It must be reset to point to python3.8
This caused due to os.readlink doesn't follow multiply symlinks, so I
suggest to use Path from pathlib.
I have attached patch with suggested changes.
** Affects: python3-defaults (Ubuntu)
Importance: Undecided
Status: New
** Patch added: "py3versions.patch"
https://bugs.launchpad.net/bugs/2015243/+attachment/5660888/+files/py3versions.patch
** Summary changed:
- py3versions desn't follow symlinks (like realpath)
+ py3versions doesn't follow symlinks (like realpath)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/2015243
Title:
py3versions doesn't follow symlinks (like realpath)
Status in python3-defaults package in Ubuntu:
New
Bug description:
In case if we have more than one python version and manage them by update-alternatives, the path to the python binary looks like:
root at devvm-14-143:~# ls -la /usr/bin/python3
lrwxrwxrwx 1 root root 25 Apr 4 08:11 /usr/bin/python3 -> /etc/alternatives/python3
root at devvm-14-143:~# ls -la /etc/alternatives/python3
lrwxrwxrwx 1 root root 18 Apr 4 08:11 /etc/alternatives/python3 -> /usr/bin/python3.8
So even we use the correct default version of python3 (like in Focal
it is python3.8) py3version will fail
root at devvm-14-143:~# py3versions -d
py3versions: the symlink /usr/bin/python3 does not point to the python3 default version. It must be reset to point to python3.8
This caused due to os.readlink doesn't follow multiply symlinks, so I
suggest to use Path from pathlib.
I have attached patch with suggested changes.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/2015243/+subscriptions
More information about the foundations-bugs
mailing list