Gentoo Archives: gentoo-portage-dev

From: "Göktürk Yüksek" <gokturk@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Göktürk Yüksek" <gokturk@g.o>
Subject: [gentoo-portage-dev] [PATCH v1] portageq: escape regex-special characters in maintainer emails #604164
Date: Fri, 30 Dec 2016 18:02:07
Message-Id: 20161230180200.18536-1-gokturk@gentoo.org
1 When the email address of a maintainer contains regex-special
2 characters (such as '+'), re.match() returns incorrect results. Use
3 re.escape() with list comprehension on maintainer emails when
4 constructing the matcher regex.
5 ---
6 bin/portageq | 2 +-
7 1 file changed, 1 insertion(+), 1 deletion(-)
8
9 diff --git a/bin/portageq b/bin/portageq
10 index d645635..376cb2b 100755
11 --- a/bin/portageq
12 +++ b/bin/portageq
13 @@ -1009,7 +1009,7 @@ list_preserved_libs.__doc__ = docstrings['list_preserved_libs']
14
15 class MaintainerEmailMatcher(object):
16 def __init__(self, maintainer_emails):
17 - self._re = re.compile("^(%s)$" % "|".join(maintainer_emails), re.I)
18 + self._re = re.compile("^(%s)$" % "|".join([re.escape(m) for m in maintainer_emails]), re.I)
19
20 def __call__(self, metadata_xml):
21 match = False
22 --
23 2.10.2

Replies