Avoid re-using old ~/.pex/code/
caches.
#1444
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original
$PEX_ROOT/code/<code_hash>
cache scheme was broken sincethe
<code_hash>
was calculated just using user code but the contentsof the cache included Pex's
__main__.py
andPEX-INFO
files. Thelatter was luckily never loaded by the Pex runtime to figure out how to
run and so the bug never surfaced.
With the introduction of the zipapp and packed runtime layout support,
these bad cache entries are now used and the
PEX-INFO
is read. Thismeans, for the case of PEXes with no user code that were also
--not-zip-safe
, all such PEXes share thePEX-INFO
of the 1st suchPEX executed in a given
$PEX_ROOT
. This leads to unexpecteddependencies and crashes when executing any such PEX other than the
seeding PEX.
Fix this by simply re-naming the
code/
cache dir root touser_code
,allowing previous PEXes to work as prior and new PEXes to also work by
completely ignoring the old buggy
code/
caches.Fixes #1443