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

Bug 315709

Summary: ebuild script: Unicode unequal comparison failed to convert both arguments to Unicode
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: minor 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: The proof-of-concept patch
Encode mycwd back to byte format
Alternative approach patch (converting PWD to unicode format)

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-17 10:42:47 UTC
When calling 'ebuild' from within a directory containing unicode characters in path, Python reports the following warning:

/usr/bin/ebuild:119: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if "PWD" in os.environ and os.environ["PWD"] != mycwd and \

I guess the reason for this is that the getcwd() function (result of which is stored in mycmd) is being wrapped by portage, and environ is not. Using getcwd() from the real os module removes the warning as the attached patch proves. But I guess it's not the way we're going to fix it.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-17 10:43:40 UTC
Created attachment 228113 [details, diff]
The proof-of-concept patch
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-17 13:04:04 UTC
Created attachment 228145 [details, diff]
Encode mycwd back to byte format

This patch performs the reverse of what portage's unicode module wrapper does, thus making the 'mycwd' suitable for comparison with os.environ['PWD'].
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-17 13:10:47 UTC
Created attachment 228147 [details, diff]
Alternative approach patch (converting PWD to unicode format)

And here's a patch offering the reverse approach to the issue. It converts the string obtained from os.environ['PWD'] to unicode like os.environ was unicode-wrapped too. This way we avoid converting mycwd forth and back.
Comment 5 Zac Medico gentoo-dev 2010-08-23 06:19:08 UTC
This is in 2.2_rc68, but I'll leave this bug open until it's in an unmasked version.
Comment 6 Zac Medico gentoo-dev 2010-09-04 08:26:48 UTC
This is fixed in 2.1.9.