-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
16.4.0 causes breakage on system python when used with dh-virtualenv #1327
Comments
@rofl0r surprising behaviour 🤔 |
well it seems a few people were relying on the exact undocumented (and bogus) semantics of previous virtualenv version. now that it works correctly they're facing reality.. on the positive side, it seems the vast majority of users has no problems. the other people which commented on #1309 fortunately figured out what went wrong and that the bug was on their end, i hope @nailor and company will do so to. |
hi, so we are not actually relying on any exact undocumented semantics here of previous versions. The issue is pretty well outlined in this comment by @jhermann: spotify/dh-virtualenv#272 (comment). To summarise the flow here:
I'd like to stress that the change of moving from symlinking to the stdlib to symlinking to actual files inside a physical directory is what creates this breakage. Dh-virtualenv is not relying on "undocumented semantics", but this change combined with how Debian packages are delpoyed (in a nuthsell just tarball), will cause this to break in unexpected way (effectively replacing your whole stdlib with looping symlinks). |
hi,
? |
BTW, anyone using plain tarballs with overwriting (i.e. unversioned target dirs) for deployment will also be affected by this. Due to the high impact of accidental overwrites, a small change in layout should be considered. Namely replacing the subdirs (encoding, importlib, …) with again symlinks to Not the prettiest layout, but then who runs a beauty contest in those dirs… @nailor Moving stuff according to this after venv creation could be a local fix in dh-venv. |
@jhermann you mean a tarball created out of a virtual-env created directory ? theoretically tar should preserve the information which files are mere symlinks. |
Debian package upgrades work by overwriting the old tree with the new tree of files (in-place), and only then purging the diff (old / removed files). The reasoning is that this provides the biggest chance for uninterrupted service / seamless upgrades, because there is no race condition window of "no files". |
tar might not have the problem, because it also stores information about directories, i.e. might handle the change of symlink → dir correctly. Well, dpkg / apt does not. |
Given files inside Debian package are actually packaged in a tar package, I would be slightly surprised not to be able to reproduce this bug with plain tar |
OK, did some digging around here. This is not replicated by just running After going through some dpkg source code and documentation, here are the relevant parts:
Last bit is why this is not happening on regular tar packages. That said, the #1309 included 16.4.0 upgrade, while itself makes sense will cause system python to be overridden upon upgrading a Debian package containing virtualenv created with <16.4.0 with a package containing a virtualenv with 16.4.0. This can be very problematic. The problem definitely is not contained to dh-virtualenv only, or to packages created only with it. This can potentially be affecting any Debian packages going over this upgrade bump. Worst case scenario for user is that they just upgrade a Debian package containing the unfortunate version bump of a virtualenv, ruining their system python completely. @gaborbernat @rofl0r I'd suggest either rolling back the change or changing the behaviour slightly as proposed by @jhermann |
tbh i find the thought of using virtual-env environments for packages a bit odd. |
There are many valid cases to do what dh-virtualenv does and why people do this same thing with other tools, but that's besides the point. I was able to reproduce this quite easily by following our tutorial. Before building the package, you can just I've attached the boilerplate package in a tar. Just extract it in a Debian based system and build it following the above steps: sample-package.tar.gz EDIT: please run this in a disposable machine (or Docker container), this will ruin the system Python |
@gaborbernat Thanks! |
Fix in #1309 is now causing dh-virtualenv to accidentally destroy Python installation. We are still digging into what we can do on our side, or what combination things is the root cause, but currently the behaviour looks pretty bad: spotify/dh-virtualenv#272
Originally posted by @nailor in #1309 (comment)
The text was updated successfully, but these errors were encountered: