Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 477764

Summary: sys-apps/portage: sanitize PYTHONPATH for ebuild helpers
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: 2.1   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 472632    

Description Zac Medico gentoo-dev 2013-07-22 16:13:57 UTC
In the ebuild environment, the PYTHONPATH variable cannot be trusted, since it may can break python. For example:

  $ PYTHONPATH=/usr/lib/python2.7 python3.3
  Fatal Python error: Py_Initialize: Unable to get the locale encoding
    File "/usr/lib/python2.7/encodings/__init__.py", line 123
      raise CodecRegistryError,\
                              ^
  SyntaxError: invalid syntax
  Aborted

We can handle this by using a known-safe PORTAGE_PYTHONPATH variable to override PYTHONPATH when calling python helpers.
Comment 2 Zac Medico gentoo-dev 2013-07-26 07:11:55 UTC
This is fixed in 2.1.13 and 2.2.0_alpha189.