-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On package upgrades, sometimes the system Python library is, well, destroyed #272
Comments
At Yelp we are hitting this too, but we are just using dh-venv 1.0.1 ... ? |
I think it is related to pypa/virtualenv#1309, specifically the comment about symlinks. I'm not sure I totally understand why the presence of symlinks cause this issue though. |
CC @gaborbernat |
Adding a little more detail about what we're seeing. We start on a working system with an old version of our dh-virtualenv package installed:
|
so the root cause appears to be that the unpacking above causes a write-through as |
I'm working around this by ensuring we are using an older version of virtualeenv. I'm also using |
Workaround / Solution: use Python3 venv, then there is no copy of the stdlib that could overwrite anything. Also makes for smaller packages. Root cause: Solution: Use venv (see above). Or remove symlinks in a "preinst" script (and check that is not too late in the package upgrade lifecycle, and the preinst is taken from the NEW package). |
The safe version of virtualenv to use seems to be 16.3.0, so installing that version also prevents the defect. Note that normally, you get the system's virtualenv which is usually older – but e.g. building in Docker can be done in a way that virtualenv is upgraded before |
With Tron we use python3.6 already, and it affects us |
The safe route is to use --builtin-venv and remove the triggers file (see commits in the project linked in 1st post). |
By the way, the ticket is referencing |
That would probably be the best route for projects still stuck to Python2. Else venv. |
Yeah, maybe we should default to use that flag when setting up the virtualenv when not using built-in venv (and default to built-in venv in future). |
FYI: Opened a new issue for virtualenv pypa/virtualenv#1327 |
|
BTW, restoring a damaged lib (2.7 in this case):
If Python stopped working altogether, you might need to copy files from another machine beforehand. Or call the above command several times. |
mam-dev/debianized-sentry@99f0c5e is the core of a solution. To be viable, the symlinks should be tarballed before deletion, and possibly restored by As in the above commit, your app install might be broken if the upgrade fails. An explicit reinstall of the old version fixes that. |
@jhermann Just to get some clarification: Does this also happen if system python upgrades (i.e. the trigger files fires?) |
No, the trigger is just useless since venv symlinks the Python binary, and references the original stdlib. |
Change on virtualenv was reverted, so I'm closing this ticket. In any case, I think this ticket popped up a few thoughts I think should be addressed for dh-virtualenv moving forward
|
Layout changes in the
lib
of virtualenvs (v16.4.0+) damage system files because symlinks are followed.Right now, this is usually only triggered if, as part of your build process, you update virtualenv to latest (e.g. when building in Docker). See https://github.com/1and1/debianized-jupyterhub/blob/67faf583d0f20215c7d0e639efd399668659d513/Dockerfile.build#L85 for an example.
Symptoms: On package install, all symlinked folders in the stdlib get their contents replaced by symlinks to self, i.e.
This happens on mere unpacking a package with new layout over an installed one with the old layout.
The text was updated successfully, but these errors were encountered: