Crash when comparing two .so files (Python 3.12)
I'm using diffoscope 252 on Fedora 39 (Python 3.12) and the tool crashes for me every time I try to compare to .so
files.
Here I am using just two random libraries from my system:
$ diffoscope libixml.so.11.1.2 libjansson.so.4.13.0
|# | N/A% None ETA: N/A Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 334, in diff
with FIFOFeeder(feeder1, fifo1_path) as fifo1, FIFOFeeder(
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 225, in __exit__
self.join()
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 258, in join
raise self._exception
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 249, in run
end_nl = self.feeder(fifo)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/feeders.py", line 126, in feeder
end_nl = feeder(out_file)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/feeders.py", line 81, in feeder
out = filter_reader(buf, filter)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/feeders.py", line 47, in filter_reader
buf = additional_filter(buf)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/elf.py", line 268, in filter
line = ObjdumpDisassembleSection.RE_SYMBOL_COMMENT.sub(r"\1", line)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, bytes found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/diffoscope/main.py", line 766, in main
sys.exit(run_diffoscope(parsed_args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/main.py", line 717, in run_diffoscope
difference = compare_root_paths(path1, path2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/utils/compare.py", line 69, in compare_root_paths
difference = compare_files(file1, file2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/utils/compare.py", line 149, in compare_files
return file1.compare(file2, source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/utils/file.py", line 532, in compare
difference = self._compare_using_details(other, source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/utils/file.py", line 467, in _compare_using_details
details.extend(
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/utils/container.py", line 197, in compare_pair
difference = compare_files(
^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/utils/compare.py", line 149, in compare_files
return file1.compare(file2, source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/elf.py", line 361, in compare
diff, excluded = Difference.from_operation_exc(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/difference.py", line 316, in from_operation_exc
difference = Difference.from_feeder(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/difference.py", line 214, in from_feeder
unified_diff = diff(feeder1, feeder2)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 334, in diff
with FIFOFeeder(feeder1, fifo1_path) as fifo1, FIFOFeeder(
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 225, in __exit__
self.join()
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 258, in join
raise self._exception
File "/usr/lib/python3.12/site-packages/diffoscope/diff.py", line 249, in run
end_nl = self.feeder(fifo)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/feeders.py", line 126, in feeder
end_nl = feeder(out_file)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/feeders.py", line 81, in feeder
out = filter_reader(buf, filter)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/feeders.py", line 47, in filter_reader
buf = additional_filter(buf)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/diffoscope/comparators/elf.py", line 268, in filter
line = ObjdumpDisassembleSection.RE_SYMBOL_COMMENT.sub(r"\1", line)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, bytes found
The fix for me is to add a b
in the line:
line = ObjdumpDisassembleSection.RE_SYMBOL_COMMENT.sub(rb"\1", line)