From 57da6a51826a671ac6d2c4da48fc7a75b6233959 Mon Sep 17 00:00:00 2001 From: mhagger Date: Tue, 18 Dec 2012 07:54:14 +0000 Subject: [PATCH] Prevent regex from matching partial symbol. The _RegexpStrategyRule class tacks '^' and '$' around a regex to match full lines only, which doesn't work when the regex contains a top level OR ("|") due to order of operations. For example, "foo|bar" becomes "^foo|bar$", which matches "foobaz" and "bazbar". Putting a non-capturing group around it fixes the problem. Patch by: Jason K O'Brien git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5409 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/symbol_strategy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvs2svn_lib/symbol_strategy.py b/cvs2svn_lib/symbol_strategy.py index a5af1dc8..1ac61853 100644 --- a/cvs2svn_lib/symbol_strategy.py +++ b/cvs2svn_lib/symbol_strategy.py @@ -86,7 +86,7 @@ class _RegexpStrategyRule(StrategyRule): ACTION(name, id); otherwise it returns SYMBOL unchanged.""" try: - self.regexp = re.compile('^' + pattern + '$') + self.regexp = re.compile('^(?:' + pattern + ')$') except re.error: raise FatalError("%r is not a valid regexp." % (pattern,)) -- 2.11.4.GIT