Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 325505 - _emerge.actions.action_info() causes UnicodeEncodeError with (Python 2 && non-tty stdout) || ((C || POSIX) locale)
Summary: _emerge.actions.action_info() causes UnicodeEncodeError with (Python 2 && non...
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
Keywords: InVCS
: 325511 (view as bug list)
Depends on:
Blocks: 335925
  Show dependency tree
Reported: 2010-06-25 13:30 UTC by Vadim A. Misbakh-Soloviov (mva)
Modified: 2010-09-04 08:33 UTC (History)
2 users (show)

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

action_info.patch (action_info.patch,333 bytes, patch)
2010-06-25 15:00 UTC, Arfrever Frehtes Taifersar Arahesis (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2010-06-25 13:30:37 UTC
Every time, I using e-file or euse, sometimes, when I use gentoolkit's equery, and sometimes, when I use binhosts i get error like this:

Traceback (most recent call last):
  File "/usr/bin/emerge", line 42, in <module>
    retval = emerge_main()
  File "/usr/lib64/portage/pym/_emerge/", line 1528, in emerge_main
    return action_info(settings, trees, myopts, valid_atoms)
  File "/usr/lib64/portage/pym/_emerge/", line 1295, in action_info
    print('%s="%s"' % (x, settings[x]))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-10: ordinal not in range(128)

I think, that it'll be better to fix portage to use unicode, except of ascii.
By the way, it is NO any non-ascii characters in queries and in tose scripts.
//with best regards, mva.
Comment 1 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2010-06-25 14:06:15 UTC
*** Bug 325511 has been marked as a duplicate of this bug. ***
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-06-25 14:26:33 UTC
After the investigation, the issue occurs in a very specific case, where:
1) one of environment variables contain unicode characters (in this case, GPG_TTY),
2) 'emerge --info' is being called with '--verbose' (or '--verbose' is specified in EMERGE_DEFAULT_OPTS),
3) stdout is not a tty/pty.

In the particular case, 'emerge --info' seems to be called by equery, and the '--verbose' switch is being appended because of EMERGE_DEFAULT_OPTS. This makes it try to output all the environmental variables, and thus results in a failure when approaching unicode characters in one of them.
Comment 3 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2010-06-25 14:47:01 UTC
Yep,  Michał is right. And, if you interested, in my case $GPG_TTY has "not a teletype" value in russian language ("не телетайп"). Of course, in unicode, due to I'm using ru_RU.UTF-8 locale.

//with best regards, mva
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-06-25 15:00:30 UTC
Created attachment 236515 [details, diff]

Please test this patch.
Comment 6 Zac Medico gentoo-dev 2010-08-23 06:25:13 UTC
This is in 2.2_rc68, but I'll leave this bug open until it's in an unmasked version.
Comment 7 Zac Medico gentoo-dev 2010-09-04 08:33:16 UTC
This is fixed in 2.1.9.