-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Do basic syntax checks on the RECORD file when installing a wheel #11762
base: main
Are you sure you want to change the base?
Conversation
This function made sense when it still had different logic based on Python 2/3. Nowadays, it's just unnecessary.
76698a8
to
a521345
Compare
To minimize potential breakage, I downloaded one wheel for each of the most popular 5000 PyPI packages (4399 wheels in total, because some packages had no wheels), and attempted to parse the
|
For now, only check requirements specified in the original RECORD specification (<https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file>), without the added constraints from the wheel specification. Some of the warnings ("invalid digest size" and "duplicate line") should really be errors, but I was able to find some popular projects that have these problems (any projects built with sphinx-theme-builder for the former, zeroconf for the latter). To avoid breaking stuff, keep these as warnings for now.
a521345
to
6a8d153
Compare
Hehe, I'm pretty sure some of this is my fault. ^>^ I'll take a closer look at this sometime next week, but I wanna explicitly say: Thank you for doing this and filing this PR! |
Is there similar logic (the record model part) in |
Yes.
We should -- although that'd be blocked on pypa/installer#153 and pypa/installer#156. |
I’m mostly thinking we can probably reuse stuff in installer that don’t exist in pip (hash-checking etc), pip logic going into installer doesn’t need to block that. |
I looked at the 'a.py,foobar=abcde,'
'a.py,sha256=~!@#$%,'
'a.py,sha256=abcde,'
'a.py,,-1'
'a.py,sha256=4OHi4-Tl5ufo6err7O3u7_Dx8vP09fb3-Pn6-_z9_v8=,'
'a.py,sha256=4OHi4+Tl5ufo6err7O3u7/Dx8vP09fb3+Pn6+/z9/v8,'
'a.py,sha256=abcdef,'
'a.py,,123\na.py,,456'
'a.py,,123\na.py,,123' |
Are you calling |
No, because my patch only checks the Now, most of the aforementioned test cases would fail if you were to validate them against wheel contents, but I think it's a good idea to check the syntax before trying to validate the contents, since in that way you can fail faster and give better error messages. |
So how do we move forward from here? Is there anything you'd like me to do? |
For now, only check requirements specified in the original RECORD specification (https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file), without the added constraints from the wheel specification.
Some of the warnings ("invalid digest size" and "duplicate line") should really be errors, but I was able to find some popular projects that have these problems (any projects built with sphinx-theme-builder for the former, zeroconf for the latter). To avoid breaking stuff, keep these as warnings for now.
Fixes #6198
Fixes #5913
Un-fixes #6165 (the underlying issue in wheel has been fixed 3 years ago, so the workaround should no longer be needed)