-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Python: strip embedded file name #31080
Comments
My fix is to remove offending .pyc file. It also does some magic related to
But still would be great of generic stripping is implemented. Also, |
Thank you for the investigation of the source of the collision. However, embedded file names are necessary for a lot of things, such as displaying source code in the backtraces and finding resources near files. The only issue is with |
@danbst How does python use these filenames in .pyc files? |
Hm. I've never seen these embedded names in callstacks. Those refer to build-time files, which don't even belong to This is more of reproducibility. Hydra-built packages and locally-built should result into same derivation. .pyc files from Hydra contain
I don't know, haven't investigated that deep.
Actually, what I tried was to remove the BTW, now I think my patch for backports is a good compromise. I should insert that |
I believe this is because Hydra use Nix 1.12 (unstable) which builds in "/build", whereas Nix 1.11 builds in "/tmp/nix-build-*". |
The collision is indeed due to #2412 (comment). If we would want to strip this filename then I think we should patch the interpreter like we did for |
Great to know I wasn't first who discovered this issue! So, there are 2 issues here:
@FRidh but I see you marked problem 2 as "wontfix" in a linked issue. What do you think about my solution? This is kind of collision that can be solved at distro level. |
The second point is OK, could you submit a pull request? As for the first point, it should be simpler to compile .pyc after copying .py files into the store. |
Yes, this is what I imagine (for all outputs). |
@FRidh @orivej I've tried to do what I've described, but got into trouble. Some backported packages do declare namespace, which makes NOT creating |
Regarding the namespace packages, there are two solutions I could think of:
|
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
Issue description
Python compile .pyc files with source filename built into them. For example, here is result of one decompilation:
Both files were produced from same source code and same nixpkgs version, but differ in source file name. We should strip this embedded file name either during compilation (patch Python) or in post-fixup phase.
There is an example of stripping done in codewarrior0/pyinstaller@a770058
Debian overcomes this issue by compiling .pyc on a user machine.
Steps to reproduce
This results into a collision. Source .py files differ indeed, but only in comments.
Technical details
cc @FRidh
The text was updated successfully, but these errors were encountered: