Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 296641 - UnicodeEncodeError in portage.eapi_is_supported()
Summary: UnicodeEncodeError in portage.eapi_is_supported()
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 288499
  Show dependency tree
 
Reported: 2009-12-12 18:13 UTC by Casey Bralla
Modified: 2009-12-13 06:34 UTC (History)
0 users

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


Attachments
avoid the UnicodeEncodeError (corrupt_eapi.patch,550 bytes, patch)
2009-12-12 19:03 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Casey Bralla 2009-12-12 18:13:23 UTC
I rebuild portage (emerge -e world) on a system with flaky memory.  I fixed the memory, but now when I try to re-emerge anything I get this error:

# emerge portage
Calculating dependencies... done!
Traceback (most recent call last):
File "/usr/bin/emerge", line 42, in <module>
retval = emerge_main()
File "/usr/lib64/portage/pym/_emerge/main.py", line 1378, in emerge_main
myopts, myaction, myfiles, spinner)
File "/usr/lib64/portage/pym/_emerge/actions.py", line 276, in action_build
settings, trees, myopts, myparams, myaction, myfiles, spinner)
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 5420, in backtrack_depgraph
myaction, myfiles, spinner)
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 5438, in _backtrack_depgraph
success, favorites = mydepgraph.select_files(myfiles)
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 1512, in select_files
self._load_vdb()
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 277, in _load_vdb
fake_vartree.sync()
File "/usr/lib64/portage/pym/_emerge/FakeVartree.py", line 102, in sync
self._sync()
File "/usr/lib64/portage/pym/_emerge/FakeVartree.py", line 152, in _sync
pkg = self._pkg(cpv)
File "/usr/lib64/portage/pym/_emerge/FakeVartree.py", line 171, in _pkg
type_name="installed")
File "/usr/lib64/portage/pym/_emerge/Package.py", line 53, in __init__
self.masks = self._masks()
File "/usr/lib64/portage/pym/_emerge/Package.py", line 67, in _masks
if not portage.eapi_is_supported(eapi):
File "/usr/lib64/portage/pym/portage/__init__.py", line 6064, in eapi_is_supported
eapi = str(eapi).strip()
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)

Any suggested work-aroudns that would let me re-emerge portage when portage won't run?

Reproducible: Always

Steps to Reproduce:
1.emerge [anything]
2.
3.

Actual Results:  
# emerge portage
Calculating dependencies... done!
Traceback (most recent call last):
File "/usr/bin/emerge", line 42, in <module>
retval = emerge_main()
File "/usr/lib64/portage/pym/_emerge/main.py", line 1378, in emerge_main
myopts, myaction, myfiles, spinner)
File "/usr/lib64/portage/pym/_emerge/actions.py", line 276, in action_build
settings, trees, myopts, myparams, myaction, myfiles, spinner)
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 5420, in backtrack_depgraph
myaction, myfiles, spinner)
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 5438, in _backtrack_depgraph
success, favorites = mydepgraph.select_files(myfiles)
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 1512, in select_files
self._load_vdb()
File "/usr/lib64/portage/pym/_emerge/depgraph.py", line 277, in _load_vdb
fake_vartree.sync()
File "/usr/lib64/portage/pym/_emerge/FakeVartree.py", line 102, in sync
self._sync()
File "/usr/lib64/portage/pym/_emerge/FakeVartree.py", line 152, in _sync
pkg = self._pkg(cpv)
File "/usr/lib64/portage/pym/_emerge/FakeVartree.py", line 171, in _pkg
type_name="installed")
File "/usr/lib64/portage/pym/_emerge/Package.py", line 53, in __init__
self.masks = self._masks()
File "/usr/lib64/portage/pym/_emerge/Package.py", line 67, in _masks
if not portage.eapi_is_supported(eapi):
File "/usr/lib64/portage/pym/portage/__init__.py", line 6064, in eapi_is_supported
eapi = str(eapi).strip()
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)


Expected Results:  
portage to emerge properly

This does not seem to be a true "bug" in portage, rather an error in my particular installation.   I report it here only to see if there is a work-around other than complete re-installation of my gentoo system.
Comment 1 Zac Medico gentoo-dev 2009-12-12 18:47:36 UTC
It looks like you have a corrupt /var/db/pkg/*/*/EAPI file.
This should solve it:

grep -l '[^[:digit:]]' /var/db/pkg/*/*/EAPI | while read x ;
do echo 0 > $x ; done
Comment 2 Zac Medico gentoo-dev 2009-12-12 19:03:03 UTC
Created attachment 212812 [details, diff]
avoid the UnicodeEncodeError

Save as /tmp/corrupt_eapi.patch and apply as follows:

  patch /usr/lib/portage/pym/portage/__init__.py /tmp/corrupt_eapi.patch
Comment 3 Casey Bralla 2009-12-12 19:10:09 UTC
(In reply to comment #2)
> Created an attachment (id=212812) [details]
> avoid the UnicodeEncodeError
> 
> Save as /tmp/corrupt_eapi.patch and apply as follows:
> 
>   patch /usr/lib/portage/pym/portage/__init__.py /tmp/corrupt_eapi.patch
> 


Thanks, Zac.  I tried your first suggestion, and that solved the problem for me.  I got a bunch of error messages of the type "Null byte found in CONTENTS entry", but portage emerged properly, and I am able to emerge other packages.
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-12-12 19:20:55 UTC
The fix hasn't been released yet.
Comment 5 Zac Medico gentoo-dev 2009-12-13 06:34:50 UTC
This is fixed in 2.1.7.14 and 2.2_rc59.