[Git][reproducible-builds/diffoscope][master] 2 commits: Rewrite the filter routine for post-processing output from readelf(1).
Chris Lamb
gitlab at salsa.debian.org
Thu Dec 10 13:04:29 UTC 2020
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
7902107b by Chris Lamb at 2020-12-10T12:50:39+00:00
Rewrite the filter routine for post-processing output from readelf(1).
- - - - -
cb3134f9 by Chris Lamb at 2020-12-10T13:03:25+00:00
Normalise "ret" to "retq" in objdump output to support multiple versions of obdump(1). (Closes: reproducible-builds/diffoscope#227, Debian:#976760)
- - - - -
1 changed file:
- diffoscope/comparators/elf.py
Changes:
=====================================
diffoscope/comparators/elf.py
=====================================
@@ -77,13 +77,18 @@ class Readelf(Command):
def filter(self, line):
try:
- # 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 self._path_re.sub("/", line).encode("utf-8")
+ val = line.decode("utf-8")
except UnicodeDecodeError:
return line
+ # we don't care about the name of the archive
+ val = self._archive_re.sub("File: lib.a(", val)
+
+ # the full path can appear in the output, we need to remove it
+ val = self._path_re.sub("/", val)
+
+ return val.encode("utf-8")
+
@staticmethod
def should_skip_section(section_name, section_type):
return False
@@ -229,7 +234,14 @@ class ObjdumpSection(Command):
if line.startswith(b"In archive"):
return b""
- return ObjdumpSection.RE_INSTRUCTION_OFFSET.sub(b"", line)
+ line = ObjdumpSection.RE_INSTRUCTION_OFFSET.sub(b"", line)
+
+ # objdump (from approximately 2.35.50.20201125-1 onwards) returns "ret"
+ # instead of "retq"; lets normalise them to "retq" for now.
+ if line == b"\tret \n":
+ return b"\tretq \n"
+
+ return line
class ObjdumpDisassembleSection(ObjdumpSection):
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/06cb774f565e95d1c36f0d396aa28bc08e7e2d00...cb3134f90106d87b05cca5a16cb7ca603f345baa
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/06cb774f565e95d1c36f0d396aa28bc08e7e2d00...cb3134f90106d87b05cca5a16cb7ca603f345baa
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/20201210/8782ae3f/attachment.htm>
More information about the rb-commits
mailing list