Validate ebuild names inside portdbapi.cp_list() in order to prevent problems later...
authorZac Medico <zmedico@gentoo.org>
Thu, 18 Jan 2007 20:37:24 +0000 (20:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 18 Jan 2007 20:37:24 +0000 (20:37 -0000)
svn path=/main/trunk/; revision=5713

pym/portage.py

index 4acb1e2018e081339ffdf260bc90aed3bb0c6c2a..69f63621484522a63c562c10c2c8204f0305a347 100644 (file)
@@ -6033,8 +6033,14 @@ class portdbapi(dbapi):
                        mytrees = self.porttrees
                for oroot in mytrees:
                        for x in listdir(oroot+"/"+mycp,EmptyOnError=1,ignorecvs=1):
-                               if x[-7:]==".ebuild":
-                                       d[mysplit[0]+"/"+x[:-7]] = None
+                               if x.endswith(".ebuild"):
+                                       pf = x[:-7]
+                                       ps = pkgsplit(pf)
+                                       if not ps:
+                                               writemsg("\nInvalid ebuild name: %s\n" % \
+                                                       os.path.join(oroot, mycp, x), noiselevel=-1)
+                                               continue
+                                       d[mysplit[0]+"/"+pf] = None
                return d.keys()
 
        def freeze(self):