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

Bug 315741

Summary: ebuild scripts: UnicodeEncodeError when appending unicode-character path to PORTDIR_OVERLAY
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: esigra
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 335925    
Attachments: Patch fixing the issue with Py2

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-17 13:18:44 UTC
The ebuild script fails to append ebuild_portdir to the PORTDIR_OVERLAY envvar whenever the former contains unicode characters:

Traceback (most recent call last):
  File "/home/mgorny/git/portage/bin/ebuild", line 134, in <module>
    os.environ.get("PORTDIR_OVERLAY","") + " " + ebuild_portdir
  File "/usr/lib64/python2.7/os.py", line 471, in __setitem__
    putenv(key, item)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 14: ordinal not in range(128)

This is because it is trying to implicitly pass unicode string to os.environ. I'm attaching a patch using _unicode_encode() function to encode the argument before passing it to os.environ.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-17 13:23:55 UTC
Created attachment 228149 [details, diff]
Patch fixing the issue with Py2

I would like to notice that although this patch fixes the issue for Python2, it causes Python3 to fail. I would like to notice too that even before the 'ebuild' script didn't work with Python3.
Comment 3 Zac Medico gentoo-dev 2010-08-23 06:19:32 UTC
This is in 2.2_rc68, but I'll leave this bug open until it's in an unmasked version.
Comment 4 Zac Medico gentoo-dev 2010-09-04 08:26:57 UTC
This is fixed in 2.1.9.