[Git][reproducible-builds/diffoscope][master] Correct the substitution/filtering of paths in ELF output to avoid unnecessary...

Chris Lamb gitlab at salsa.debian.org
Wed Nov 27 16:41:21 UTC 2019



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
43d7bd11 by Chris Lamb at 2019-11-27T16:40:48Z
Correct the substitution/filtering of paths in ELF output to avoid unnecessary differences depending on the path name provided to diffoscope. (Closes: reproducible-builds/diffoscope#80, Debian:#945572)

- - - - -


1 changed file:

- diffoscope/comparators/elf.py


Changes:

=====================================
diffoscope/comparators/elf.py
=====================================
@@ -59,6 +59,9 @@ class Readelf(Command):
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
         # we don't care about the name of the archive
+        self._path_re = re.compile(
+            r'\b%s/\b' % re.escape(os.path.dirname(self.path))
+        )
         self._archive_re = re.compile(r'^File: %s\(' % re.escape(self.path))
 
     @tool_required('readelf')
@@ -77,7 +80,7 @@ class Readelf(Command):
             # we don't care about the name of the archive
             line = self._archive_re.sub('File: lib.a(', line.decode('utf-8'))
             # the full path can appear in the output, we need to remove it
-            return line.replace(self.path, '<elf>').encode('utf-8')
+            return self._path_re.sub('/', line).encode('utf-8')
         except UnicodeDecodeError:
             return line
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/43d7bd11f53b6b8dd315d7472f5868f892c5c0f9

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/43d7bd11f53b6b8dd315d7472f5868f892c5c0f9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20191127/5be56fc2/attachment.htm>


More information about the rb-commits mailing list