virtualenv-tools is unreliable for changing path in venvs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Fix Released
|
Critical
|
Jean-Philippe Evrard |
Bug Description
virtualenv-tools has been unmaintained for a while, or at least it has not changed for a while, while still having pending PR.
(Edit: It's a dead project, according to its author [7])
In the past we raised a few issues against it [2], and had to do conditional behavior depending on distros [1].
virtualenv-tools is also a python2 only tool, and will break with python3 (it would be easy to move it to python3, because the code is simple, but I foresee issues with the print statements already!).
Anyway, on top of that we are victim of a bug while changing paths.
Our repo-build process builds a virtualenv and pip install software into it. By default, the shabang of python binaries in the virtualenv's archive is something like #!/tmp/
This lines comes virtualenv itself, as proven by the first line of the venv build's log (for example /var/log/
This line comes is logged during our venv-build-
This venv-build-
Long story short, the "New executable" line come from [3], which formats the py_executable, whose value is (unless python interpreter path is set with -p), coming from sys.executable [4], if I am not mistaken.
I didn't dig deeper on the following part, but I expect that some sys.executable can be different on different systems, which would explain why some could return python2 instead of python.
So on those systems, the generated line would be #!/tmp/
(Edit: This probably comes from the shabang of /usr/bin/
could contain python2 instead of python
Edit 2: That is exact, see [8] for gate tests to prove this)
virtualenv-tools wouldn't recognize those shabangs [6] because they don't end with python (they would end with python2), and therefore won't modify them.
The impact is now that the pip installed packages in the venv are pointing to a wrong executable and therefore can't execute: the path #!/tmp/
We should probably get rid of virtualenv-tools, or be more explicit with the executable used, all the way in the process, and replace it with simply line in files (sedding) the py files. The binary files should not be shipped in the virtualenv tgz anyway.
[1]: https:/
[2]: https:/
[3]: https:/
[4]: https:/
[5]: http://
[6]: https:/
[7]: https:/
[8]: https:/
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in openstack-ansible: | |
importance: | Undecided → Critical |
assignee: | nobody → Jean-Philippe Evrard (jean-philippe-evrard) |
Changed in openstack-ansible: | |
status: | New → Confirmed |
status: | Confirmed → In Progress |
Changed in openstack-ansible: | |
assignee: | Jean-Philippe Evrard (jean-philippe-evrard) → Mohammed Naser (mnaser) |
Changed in openstack-ansible: | |
assignee: | Mohammed Naser (mnaser) → Jean-Philippe Evrard (jean-philippe-evrard) |
Changed in openstack-ansible: | |
assignee: | Jean-Philippe Evrard (jean-philippe-evrard) → Mohammed Naser (mnaser) |
Changed in openstack-ansible: | |
status: | In Progress → Fix Released |
Fix proposed to branch: master /review. openstack. org/531731
Review: https:/