[Reproducible-commits] [diffoscope] 01/01: Encode file path when filtering it from readelf output

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Sep 5 13:01:47 UTC 2015


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

lunar pushed a commit to branch master
in repository diffoscope.

commit 6fba8d5a24845706eddba458817cb1e21f95b698
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sat Sep 5 12:52:43 2015 +0000

    Encode file path when filtering it from readelf output
    
    This fixes diffoscope for gnome-clocks.
---
 diffoscope/comparators/elf.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/elf.py b/diffoscope/comparators/elf.py
index a0fd9c2..21d8fda 100644
--- a/diffoscope/comparators/elf.py
+++ b/diffoscope/comparators/elf.py
@@ -30,6 +30,8 @@ class Readelf(Command):
         super(Readelf, self).__init__(*args, **kwargs)
         # we don't care about the name of the archive
         self._archive_re = re.compile(r'^File: %s\(' % re.escape(self.path))
+        self._encoded_path = self.path.encode('utf-8')
+        self._basename = os.path.basename(self._encoded_path)
 
     @tool_required('readelf')
     def cmdline(self):
@@ -42,7 +44,7 @@ class Readelf(Command):
         # we don't care about the name of the archive
         line = self._archive_re.sub('File: lib.a(', line)
         # the full path can appear in the output, we need to remove it
-        return line.replace(self.path, os.path.basename(self.path))
+        return line.replace(self._encoded_path, self._basename)
 
 class ReadelfAll(Readelf):
     def readelf_options(self):
@@ -57,6 +59,8 @@ class ObjdumpDisassemble(Command):
         super(ObjdumpDisassemble, self).__init__(*args, **kwargs)
         # we don't care about the name of the archive
         self._archive_re = re.compile(r'^In archive %s:' % re.escape(self.path))
+        self._encoded_path = self.path.encode('utf-8')
+        self._basename = os.path.basename(self._encoded_path)
 
     @tool_required('objdump')
     def cmdline(self):
@@ -66,7 +70,7 @@ class ObjdumpDisassemble(Command):
         # we don't care about the name of the archive
         line = self._archive_re.sub('In archive:', line)
         # the full path can appear in the output, we need to remove it
-        return line.replace(self.path, os.path.basename(self.path))
+        return line.replace(self._encoded_path, self._basename)
 
 def _compare_elf_data(path1, path2):
     differences = []

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



More information about the Reproducible-commits mailing list