Protect string indexes during input stripping in dep_getkey and dep_getcpv.
authorJason Stubbs <jstubbs@gentoo.org>
Sat, 8 Apr 2006 03:01:20 +0000 (03:01 -0000)
committerJason Stubbs <jstubbs@gentoo.org>
Sat, 8 Apr 2006 03:01:20 +0000 (03:01 -0000)
Bug #129193

svn path=/main/trunk/; revision=3094

pym/portage.py

index 2dc3248658ce59e82f8c0ce8f8dc3c6dcbec9e68..00d87dbd60e84ff25c18be109808e115e6b73381 100644 (file)
@@ -3208,19 +3208,17 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0):
 
 
 def dep_getkey(mydep):
-       if not len(mydep):
-               return mydep
-       if mydep[0]=="*":
+       if mydep and mydep[0]=="*":
                mydep=mydep[1:]
-       if mydep[-1]=="*":
+       if mydep and mydep[-1]=="*":
                mydep=mydep[:-1]
-       if mydep[0]=="!":
+       if mydep and mydep[0]=="!":
                mydep=mydep[1:]
        if mydep[:2] in [ ">=", "<=" ]:
                mydep=mydep[2:]
        elif mydep[:1] in "=<>~":
                mydep=mydep[1:]
-       if isspecific(mydep):
+       if mydep and isspecific(mydep):
                mysplit=catpkgsplit(mydep)
                if not mysplit:
                        return mydep
@@ -3229,13 +3227,11 @@ def dep_getkey(mydep):
                return mydep
 
 def dep_getcpv(mydep):
-       if not len(mydep):
-               return mydep
-       if mydep[0]=="*":
+       if mydep and mydep[0]=="*":
                mydep=mydep[1:]
-       if mydep[-1]=="*":
+       if mydep and mydep[-1]=="*":
                mydep=mydep[:-1]
-       if mydep[0]=="!":
+       if mydep and mydep[0]=="!":
                mydep=mydep[1:]
        if mydep[:2] in [ ">=", "<=" ]:
                mydep=mydep[2:]