Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 315741 - ebuild scripts: UnicodeEncodeError when appending unicode-character path to PORTDIR_OVERLAY
Summary: ebuild scripts: UnicodeEncodeError when appending unicode-character path to P...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 335925
  Show dependency tree
 
Reported: 2010-04-17 13:18 UTC by Michał Górny
Modified: 2010-09-04 08:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch fixing the issue with Py2 (portage-315741-encode-ebuild_portdir.diff,852 bytes, patch)
2010-04-17 13:23 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.