pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.52k stars 258 forks source link

Fix vendored attrs `sys.path` leak. #2328

Closed jsirois closed 7 months ago

jsirois commented 7 months ago

Whenever a given Python interpreter on a machine was 1st identified by Pex during the PEX boot process, Pex's own vendored attrs would be leaked onto the hermetic sys.path of that interpreter forevermore. This would lead to Pex's vendored attrs not being scrubbed from the sys.path during PEX boot handoff to user code.

zmanji commented 7 months ago

I can confirm this bug exists on my local machine by running:

fd -t f .  /Users/zmanji/.pex/interpreters/ -X 'jq' '.sys_path'

And seeing some entries have /Users/zmanji/.pex/isolated/194b5174b81632b65d29e39489cf61230eecfa7a/pex/vendor/_vendored/attrs which is unexpected.