Bug#891903: diffoscope: programming error in except clause
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Fri Mar 2 10:03:13 UTC 2018
Package: diffoscope
Version: 91
Severity: normal
Dear Maintainer,
I'm trying to update diffoscope to version 91 in Fedora rawhide, and
the tests failing for reasons I haven't diagnosed yet (it builds fine
locally, but fails on an s390x builder). When the tests are failing, a
try..except clause is reached which normally wouldn't be reached, and the
code there is non-python3-compatible:
E subprocess.CalledProcessError: Command '['objdump', '--line-numbers', '--disassemble', '--demangle', '--section=.text', '/tmp/tmp5ujok4po_diffoscope/0/2.o']' returned non-zero exit status 1.
diffoscope/feeders.py:94: CalledProcessError
During handling of the above exception, another exception occurred:
rlib1 = <<class 'abc.ArFile'> /builddir/build/BUILD/diffoscope-91/tests/data/test1.rlib>
rlib2 = <<class 'abc.ArFile'> /builddir/build/BUILD/diffoscope-91/tests/data/test2.rlib>
@pytest.fixture
def differences(rlib1, rlib2):
> return rlib1.compare(rlib2).details
tests/comparators/test_rlib.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
diffoscope/comparators/utils/file.py:362: in compare
difference = self._compare_using_details(other, source)
diffoscope/comparators/utils/file.py:317: in _compare_using_details
details.extend(self.as_container.compare(other.as_container, no_recurse=no_recurse))
diffoscope/comparators/utils/container.py:174: in compare_pair
difference = compare_files(file1, file2, source=None, diff_content_only=no_recurse)
diffoscope/comparators/utils/compare.py:117: in compare_files
return file1.compare(file2, source)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <<class 'abc.ElfFile'> alloc_system-d16b8f0e.0.o>
other = <<class 'abc.ElfFile'> alloc_system-d16b8f0e.0.o>, source = None
def compare(self, other, source=None):
if hasattr(self, 'compare_details') or self.as_container:
try:
difference = self._compare_using_details(other, source)
# no differences detected inside? let's at least do a binary diff
if difference is None:
difference = self.compare_bytes(other, source=source)
if difference is None:
return None
difference.add_comment(
"No file format specific differences found inside, "
"yet data differs ({})".format(self.magic_file_type),
)
except subprocess.CalledProcessError as e:
difference = self.compare_bytes(other, source=source)
if e.output:
> output = re.sub(r'^', ' ', e.output.decode('utf-8', errors='replace'), flags=re.MULTILINE)
E AttributeError: 'str' object has no attribute 'decode'
diffoscope/comparators/utils/file.py:375: AttributeError
It seem pretty clear that .decode() is called on a str object, which cannot work.
The full log is at https://kojipkgs.fedoraproject.org//work/tasks/2918/25412918/build.log.
Zbyszek
More information about the Reproducible-builds
mailing list