Traceback (most recent call last): File "/usr/lib/python-exec/python3.4/emerge", line 50, in <module> retval = emerge_main() File "/usr/lib/python3.4/site-packages/_emerge/main.py", line 1174, in emerge_main return run_action(emerge_config) File "/usr/lib/python3.4/site-packages/_emerge/actions.py", line 3231, in run_action emerge_config.args, spinner) File "/usr/lib/python3.4/site-packages/_emerge/actions.py", line 356, in action_build favorites=favorites) File "/usr/lib/python3.4/site-packages/_emerge/depgraph.py", line 7967, in display return display(self, mylist, favorites, verbosity) File "/usr/lib/python3.4/site-packages/_emerge/resolver/output.py", line 861, in __call__ self.verbose_size(pkg, None, pkg_info) File "/usr/lib/python3.4/site-packages/_emerge/resolver/output.py", line 334, in verbose_size self.verboseadd += localized_size(mysize) File "/usr/lib/python3.4/site-packages/portage/localization.py", line 41, in localized_size formatted_num = locale.format('%d', num_kib, grouping=True) File "/usr/lib/python3.4/locale.py", line 195, in format return _format(percent, value, grouping, monetary, *additional) File "/usr/lib/python3.4/locale.py", line 216, in _format formatted, seps = _group(formatted, monetary=monetary) File "/usr/lib/python3.4/locale.py", line 140, in _group conv = localeconv() File "/usr/lib/python3.4/locale.py", line 111, in localeconv d = _localeconv() UnicodeDecodeError: 'locale' codec can't decode byte 0xc2 in position 0: Invalid or incomplete multibyte or wide character
It must be a python bug or something wrong with the locale. We'll just have to handle the UnicodeDecodeError inside that portage.localization.localized_size function, and just fallback to some kind of dumb formatting.
Looking at Modules/_localemodule.c in the python source tree, it must be failing to decode the locale data in the PyLocale_localeconv function where it calls this code: #define RESULT_STRING(s)\ do { \ x = PyUnicode_DecodeLocale(l->s, NULL); \ RESULT(#s, x); \ } while (0) The PyUnicode_DecodeLocale function is defined in Objects/unicodeobject.c, and it is capable of raising UnicodeDecodeError. So, I think our best course of action is to handle the UnicodeDecodeError as suggested in comment #1.
There's a patch in the following branch: https://github.com/zmedico/portage/tree/bug_577862 It can be applied as follows: mkdir -p /etc/portage/patches/sys-apps/portage wget -O /etc/portage/patches/sys-apps/portage/bug_577862.patch \ https://github.com/zmedico/portage/commit/327834be018781c7e6da9734140f74e6d4e23c6a.patch emerge -1 portage I've posted the patch for review here: https://archives.gentoo.org/gentoo-portage-dev/message/ec52ee334e5336f747720df007046a0f
This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=33c8d30cc10cb11cb098d4dfe92f7187b20eefaf
Fixed in 2.3.0.