-
Notifications
You must be signed in to change notification settings - Fork 157
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
Order of files in the generated ZIP file is indeterministic #183
Comments
This issue does not seem to be solved entirely: $ diffoscope /nix/store/bcr7zspwddzr93ab31a7zw4qv6bj3z45-python3.6-py-1.4.34 /nix/store/bcr7zspwddzr93ab31a7zw4qv6bj3z45-python3.6-py-1.4.34.check
--- /nix/store/bcr7zspwddzr93ab31a7zw4qv6bj3z45-python3.6-py-1.4.34
+++ /nix/store/bcr7zspwddzr93ab31a7zw4qv6bj3z45-python3.6-py-1.4.34.check
├── lib
│ ├── python3.6
│ │ ├── site-packages
│ │ │ ├── py-1.4.34.dist-info
│ │ │ │ ├── RECORD
│ │ │ │ │┄ ordering differences only
│ │ │ │ │ @@ -35,40 +35,40 @@
│ │ │ │ │ py-1.4.34.dist-info/LICENSE.txt,sha256=lzT2iwmQMhJkdHxOoJR_hS0kgPQRX2RJzjv7_aF32OM,1080
│ │ │ │ │ py-1.4.34.dist-info/METADATA,sha256=hEWF428bV0ssV8MGbb9VHcTn-XAn2DAvnzf1PkHJb-Y,1732
│ │ │ │ │ py-1.4.34.dist-info/RECORD,,
│ │ │ │ │ py-1.4.34.dist-info/WHEEL,sha256=kdsN-5OJAZIiHN-iO4Rhl82KyS0bDWf4uBwMbkNafr8,110
│ │ │ │ │ py-1.4.34.dist-info/metadata.json,sha256=5kCkr9nTzxboZYvPq9Cjw2k8WuzOL2UjsIcYaGRXJe0,1010
│ │ │ │ │ py-1.4.34.dist-info/top_level.txt,sha256=rwh8_ukTaGscjyhGkBVcsGOMdc-Cfdz2QH7BKGENv-4,3
│ │ │ │ │ py-1.4.34.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
│ │ │ │ │ -py/_path/__pycache__/common.cpython-36.pyc,,
│ │ │ │ │ -py/_path/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ -py/_path/__pycache__/local.cpython-36.pyc,,
│ │ │ │ │ -py/_path/__pycache__/cacheutil.cpython-36.pyc,,
│ │ │ │ │ -py/_path/__pycache__/svnurl.cpython-36.pyc,,
│ │ │ │ │ -py/_path/__pycache__/svnwc.cpython-36.pyc,,
│ │ │ │ │ +py/__pycache__/test.cpython-36.pyc,,
│ │ │ │ │ +py/__pycache__/_xmlgen.cpython-36.pyc,,
│ │ │ │ │ py/__pycache__/_std.cpython-36.pyc,,
│ │ │ │ │ -py/__pycache__/_builtin.cpython-36.pyc,,
│ │ │ │ │ -py/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ py/__pycache__/_iniconfig.cpython-36.pyc,,
│ │ │ │ │ -py/__pycache__/_xmlgen.cpython-36.pyc,,
│ │ │ │ │ -py/__pycache__/test.cpython-36.pyc,,
│ │ │ │ │ -py/__pycache__/_apipkg.cpython-36.pyc,,
│ │ │ │ │ py/__pycache__/_error.cpython-36.pyc,,
│ │ │ │ │ +py/__pycache__/_builtin.cpython-36.pyc,,
│ │ │ │ │ +py/__pycache__/_apipkg.cpython-36.pyc,,
│ │ │ │ │ py/__pycache__/__metainfo.cpython-36.pyc,,
│ │ │ │ │ -py/_io/__pycache__/saferepr.cpython-36.pyc,,
│ │ │ │ │ -py/_io/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ -py/_io/__pycache__/capture.cpython-36.pyc,,
│ │ │ │ │ -py/_io/__pycache__/terminalwriter.cpython-36.pyc,,
│ │ │ │ │ -py/_process/__pycache__/cmdexec.cpython-36.pyc,,
│ │ │ │ │ +py/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ +py/_process/__pycache__/killproc.cpython-36.pyc,,
│ │ │ │ │ py/_process/__pycache__/forkedfunc.cpython-36.pyc,,
│ │ │ │ │ +py/_process/__pycache__/cmdexec.cpython-36.pyc,,
│ │ │ │ │ py/_process/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ -py/_process/__pycache__/killproc.cpython-36.pyc,,
│ │ │ │ │ -py/_log/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ -py/_log/__pycache__/log.cpython-36.pyc,,
│ │ │ │ │ +py/_path/__pycache__/svnwc.cpython-36.pyc,,
│ │ │ │ │ +py/_path/__pycache__/svnurl.cpython-36.pyc,,
│ │ │ │ │ +py/_path/__pycache__/local.cpython-36.pyc,,
│ │ │ │ │ +py/_path/__pycache__/common.cpython-36.pyc,,
│ │ │ │ │ +py/_path/__pycache__/cacheutil.cpython-36.pyc,,
│ │ │ │ │ +py/_path/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ py/_log/__pycache__/warning.cpython-36.pyc,,
│ │ │ │ │ -py/_code/__pycache__/_assertionold.cpython-36.pyc,,
│ │ │ │ │ +py/_log/__pycache__/log.cpython-36.pyc,,
│ │ │ │ │ +py/_log/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ +py/_io/__pycache__/terminalwriter.cpython-36.pyc,,
│ │ │ │ │ +py/_io/__pycache__/saferepr.cpython-36.pyc,,
│ │ │ │ │ +py/_io/__pycache__/capture.cpython-36.pyc,,
│ │ │ │ │ +py/_io/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ py/_code/__pycache__/source.cpython-36.pyc,,
│ │ │ │ │ -py/_code/__pycache__/_py2traceback.cpython-36.pyc,,
│ │ │ │ │ py/_code/__pycache__/code.cpython-36.pyc,,
│ │ │ │ │ -py/_code/__pycache__/__init__.cpython-36.pyc,,
│ │ │ │ │ -py/_code/__pycache__/_assertionnew.cpython-36.pyc,,
│ │ │ │ │ py/_code/__pycache__/assertion.cpython-36.pyc,,
│ │ │ │ │ +py/_code/__pycache__/_py2traceback.cpython-36.pyc,,
│ │ │ │ │ +py/_code/__pycache__/_assertionold.cpython-36.pyc,,
│ │ │ │ │ +py/_code/__pycache__/_assertionnew.cpython-36.pyc,,
│ │ │ │ │ +py/_code/__pycache__/__init__.cpython-36.pyc,, I've had more cases where the order is still not deterministic, e.g.
|
How did you reproduce the problem? |
I'd like to point out that the files marked here are |
Well, they do appear in the This is with our Nix builds, with NixOS/nixpkgs@a30fa6d, which has wheel at 0.30.0, setuptools at 36.4.0 and pip at 9.0.1. |
Also, according to PEP 427 wheels may contain bytecode:
|
Can you give me exact repro steps for this? No matter what I do, I cannot reproduce the problem locally. |
And by that I mean that even if the |
That is going to be interesting, due to our build infra. Short story, we build our packages using What is relevant is how we do the building of the wheels. The exact line for building the wheel is:
where |
So are you saying that the actual generated wheel files (and not just the installation directories) contain |
So, the wheels do not contain |
So it seems that wheel indeed updates the |
That's correct, and pip does this as well. The |
I'll open an issue on the Pip tracker. Both pip and wheel seem to have their own implementation on how to install a wheel. Scanning wheel's implementation, they seem to do the ordering correct (though I could have missed it), but looking at Pip's implementation, they seem to be using a set to record what is installed. Now, I suppose that should still be fine with |
Oh, look at that. It should be fixed on Pip master: pypa/pip#4667 |
Originally reported by: Matthias Bach (Bitbucket: MatthiasBach, GitHub: Unknown)
While the order of entries in the RECORDS files is explicitly made deterministic, everything but the dist-info directory is written to the generated ZIP file in random order. Technically it relies on
os.walk
, but that gives an undefined order. When attempting to create reproducible builds this can cause builds on different working copies to produce wheels with different check sums. Sadly this is pretty hard to test for, as given the unspecified order ofos.walk
there is no definitive way to mess it up.The text was updated successfully, but these errors were encountered: