-
Notifications
You must be signed in to change notification settings - Fork 3.3k
RECORD size and hash do not reflect rewritten shebangs #10744
Copy link
Copy link
Closed
Labels
state: needs reproducerNeed to reproduce issueNeed to reproduce issuetype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
Description
When installing a wheel, pip rewrites the shebang in scripts in {dist}-{ver}.dist-info/scripts/ from #!python to the appropriate path to the Python interpreter. However, the hash and size in RECORD for the script correspond to the original version of the script, not the rewritten version.
Expected behavior
I expected the RECORD to reflect the files that actually get installed, so that an install can be integrity-checked.
pip version
20.3.4
Python version
3.9.9
OS
Parabola GNU/Linux-libre (like Arch Linux)
How to Reproduce
- Use pip to install a wheel that contains a
{dist}-{ver}.dist-info/scripts/*script with a#!pythonshebang. One such wheel is websocket-client 0.57.0. - Check whether the hash and size of the script match what got recorded in
RECORD.
Output
$ wget https://files.pythonhosted.org/packages/4c/5f/f61b420143ed1c8dc69f9eaec5ff1ac36109d52c80de49d66e0c36c3dfdf/websocket_client-0.57.0-py2.py3-none-any.whl
…
$ pip install --ignore-installed --no-deps --prefix=testdir ./websocket_client-0.57.0-py2.py3-none-any.whl
…
$ # Observe what the resulting RECORD says
$ grep bin/w testdir/lib/python3.9/site-packages/websocket_client-0.57.0.dist-info/RECORD
../../../bin/wsdump.py,sha256=S54et6zebnxb2VJcgBadSnvXblK1iBF93ap54hlc5O8,6403
$ # Observe whether this matches the resulting script file
$ sha256sum testdir/bin/wsdump.py | xargs python -c 'import sys, base64; print(base64.b64encode(bytes.fromhex(sys.argv[1])).decode("utf-8"))'
6GQkITdeQFmlpL7/T9+O/X0sWsKeddIZCvwtU0ld+hc=
$ wc -c < testdir/bin/wsdump.py
6412
$ # Observe whether this matches the original script in the wheel
$ bsdtar xfO websocket_client-0.57.0-py2.py3-none-any.whl websocket_client-0.57.0.data/scripts/wsdump.py | sha256sum | xargs python -c 'import sys, base64; print(base64.b64encode(bytes.fromhex(sys.argv[1])).decode("utf-8"))'
S54et6zebnxb2VJcgBadSnvXblK1iBF93ap54hlc5O8=
$ bsdtar xfO websocket_client-0.57.0-py2.py3-none-any.whl websocket_client-0.57.0.data/scripts/wsdump.py |wc -c
6403Code of Conduct
- I agree to follow the PSF Code of Conduct.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
state: needs reproducerNeed to reproduce issueNeed to reproduce issuetype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior