Title: Lib2to3 fails with unreadable pickle file
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7, Python 3.6, Python 3.3, Python 3.4, Python 3.5, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Jake Merdich
Priority: normal Keywords: patch

Created on 2017-04-18 23:57 by Jake Merdich, last changed 2017-04-18 23:57 by Jake Merdich.

File name Uploaded Description Edit
0001-Fallback-to-regenerating-2to3-grammars-on-read-fail.patch Jake Merdich, 2017-04-18 23:57
Messages (1)
msg291853 - (view) Author: Jake Merdich (Jake Merdich) * Date: 2017-04-18 23:57
There seem to have been a few issues in the past with creating the lib2to3 pickle files with the right permissions due to umask behavior (#15890). While I'm unaware of the status installer-level fixes have given, it seems prudent that the installed python should always function, given there is an obvious and trivial fallback (regenerating the grammar tables at runtime).

The current codebase will throw a PermissionDenied exception if the pickle file is unreadable, rather than fall back to generating the grammar tables. 

To reproduce:
 Install python2.6+, 3.0+
 chmod o-r $PYTHON_INSTALL/lib/pythonX.Y/lib2to3/*.pickle
 pythonX.Y -c "import lib2to3.pygram"

Notably, this sort of borked installation is quite hard to detect.... unless a user without root tries to run setuptools (*whistles*).
Date User Action Args
2017-04-18 23:57:59Jake Merdichcreate