[diffoscope] 05/05: comparators.apk: Use re.escape when generating regex.

Chris Lamb chris at chris-lamb.co.uk
Mon Jan 9 12:32:17 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 422cce8572f84ec2fce6f324be126fd77e1ed70b
Author: Chris Lamb <lamby at debian.org>
Date:   Mon Jan 9 11:27:44 2017 +0000

    comparators.apk: Use re.escape when generating regex.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/apk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffoscope/comparators/apk.py b/diffoscope/comparators/apk.py
index 2a923aa..8f70ec3 100644
--- a/diffoscope/comparators/apk.py
+++ b/diffoscope/comparators/apk.py
@@ -96,7 +96,7 @@ def filter_apk_metadata(filepath, archive_name):
     with open(filepath) as f:
         with open(new_filename, "w") as f_out:
             for line in f:
-                if not re.match(r'^apkFileName: %s' % os.path.basename(archive_name), line):
+                if not re.match(r'^apkFileName: %s' % re.escape(os.path.basename(archive_name)), line):
                     f_out.write(line)
     os.remove(filepath)
     return new_filename

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list