summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-30 20:06:33 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-30 20:06:33 +0000
commitecf60ce769f6b482d6312142ea1f91c2573c4425 (patch)
tree36ad4d634f984209d51dc81e25afa8bbbf1b87e0 /pym
parent0d55b39ea89067117377e2fd66a5e16609a25199 (diff)
downloadportage-ecf60ce769f6b482d6312142ea1f91c2573c4425.tar.gz
portage-ecf60ce769f6b482d6312142ea1f91c2573c4425.tar.bz2
portage-ecf60ce769f6b482d6312142ea1f91c2573c4425.zip
For bug #151326, prevent invalid comments from being returned by portage.getmaskingreason().
svn path=/main/trunk/; revision=5428
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 735920cf7..18e8ef51b 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -4328,16 +4328,23 @@ def getmaskingreason(mycpv, settings=None, portdb=None):
if mycpv in portdb.xmatch("match-all", x):
comment = ""
l = "\n"
- i = 0
- while i < len(pmasklines):
+ comment_valid = -1
+ for i in xrange(len(pmasklines)):
l = pmasklines[i].strip()
if l == "":
comment = ""
+ comment_valid = -1
elif l[0] == "#":
comment += (l+"\n")
+ comment_valid = i + 1
elif l == x:
+ if comment_valid != i:
+ comment = ""
return comment
- i = i + 1
+ elif comment_valid != -1:
+ # Apparently this comment applies to muliple masks, so
+ # it remains valid until a blank line is encountered.
+ comment_valid += 1
return None
def getmaskingstatus(mycpv, settings=None, portdb=None):