Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 315709 - ebuild script: Unicode unequal comparison failed to convert both arguments to Unicode
Summary: ebuild script: Unicode unequal comparison failed to convert both arguments to...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 335925
  Show dependency tree
 
Reported: 2010-04-17 10:42 UTC by Michał Górny
Modified: 2010-09-04 08:26 UTC (History)
1 user (show)

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


Attachments
The proof-of-concept patch (portage-315709-getcwd-proofofconcept.diff,468 bytes, patch)
2010-04-17 10:43 UTC, Michał Górny
Details | Diff
Encode mycwd back to byte format (portage-315709-convert-mycwd-to-bytes.diff,755 bytes, patch)
2010-04-17 13:04 UTC, Michał Górny
Details | Diff
Alternative approach patch (converting PWD to unicode format) (portage-315709-convert-PWD-to-unicode.diff,1.12 KB, patch)
2010-04-17 13:10 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 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.