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

Bug 548556

Summary: sys-apps/portage: varexpand IndexError triggered by string ending with $
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: arpad.kunszt, c.affolter
Priority: Normal Keywords: InVCS
Version: 2.2   
Hardware: All   
OS: All   
URL: https://forums.gentoo.org/viewtopic-t-1016432.html
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 484436    

Description Zac Medico gentoo-dev 2015-05-04 05:00:00 UTC
$ python -c 'from portage.util import varexpand; varexpand("$")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.4/site-packages/portage/util/__init__.py", line 853, in varexpand
    if mystring[pos] == "{":
Comment 1 Zac Medico gentoo-dev 2015-05-04 06:06:36 UTC
There's a patch in the following branch:

https://github.com/zmedico/portage/tree/bug_548556

I've posted it for review here:

https://archives.gentoo.org/gentoo-portage-dev/message/d4bf671f303983866214866427de66a1
Comment 3 Alexey Dobriyan 2015-05-04 11:40:42 UTC
Hello, Zac.

I'm getting "mystring[pos]" errors when trying to emerge any package (including portage itself):

>>> Installing (1 of 1) sys-apps/portage-2.2.18::gentoo
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/portage/dbapi/_MergeProcess.py", line 234, in _spawn
    prev_mtimes=self.prev_mtimes, counter=counter)
  File "/usr/lib64/python2.7/site-packages/portage/dbapi/vartree.py", line 4985, in merge
    counter=counter)
  File "/usr/lib64/python2.7/site-packages/portage/dbapi/vartree.py", line 4178, in treewalk
    self._linkmap_rebuild(include_file=needed)
  File "/usr/lib64/python2.7/site-packages/portage/dbapi/vartree.py", line 2941, in _linkmap_rebuild
    self.vartree.dbapi._linkmap.rebuild(**kwargs)
  File "/usr/lib64/python2.7/site-packages/portage/util/_dyn_libs/LinkageMapELF.py", line 343, in rebuild
    for x in entry.runpaths)
  File "/usr/lib64/python2.7/site-packages/portage/util/_dyn_libs/LinkageMapELF.py", line 343, in <genexpr>
    for x in entry.runpaths)
  File "/usr/lib64/python2.7/site-packages/portage/util/__init__.py", line 844, in varexpand
    if mystring[pos] == "{":
IndexError: string index out of range

--------------------------------------
should I just apply patch locally?
Comment 4 Brian Dolbec (RETIRED) gentoo-dev 2015-05-04 15:50:43 UTC
Yes, that will get it indicating what is causing the indexerror and/or get it working.
Comment 5 Brian Dolbec (RETIRED) gentoo-dev 2015-05-19 19:52:33 UTC
Released in portage-2.2.19