From e402103396709dabbb38f7ae0a6707fc6a0477f3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 18 Jan 2007 20:37:24 +0000 Subject: [PATCH] Validate ebuild names inside portdbapi.cp_list() in order to prevent problems later on. Thanks to delusions for reporting on irc. svn path=/main/trunk/; revision=5713 --- pym/portage.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pym/portage.py b/pym/portage.py index 4acb1e201..69f636214 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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): -- 2.26.2