Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD

Guangyuan Yang ygy at freebsd.org
Thu Jan 11 20:18:06 UTC 2018


Source: diffoscope
Version: 90
Severity: normal

Test suite is failing on FreeBSD during the collecting phase:

_______________________________________ ERROR collecting
tests/comparators/test_elf.py _______________________________________
tests/comparators/test_elf.py:64: in <module>
    @skip_if_tool_version_is('readelf', readelf_version, '2.29')
tests/utils/tools.py:46: in skip_if_tool_version_is
    vcls(str(actual_ver)) == vcls(str(target_ver)),
/usr/local/lib/python3.6/distutils/version.py:46: in __eq__
    c = self._cmp(other)
/usr/local/lib/python3.6/distutils/version.py:337: in _cmp
    if self.version < other.version:
E   TypeError: '<' not supported between instances of 'str' and 'int'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during
collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The reason being the unexpected output format of `readelf --version` on
FreeBSD:

readelf --version

readelf (elftoolchain r3561M)

On Ubuntu for example, the result is:

readelf --version

GNU readelf (GNU Binutils for Ubuntu) 2.29.1
Copyright (C) 2017 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later
version.
This program has absolutely no warranty.

Since the implementation of `skip_if_tool_version_is` is:

return out.decode('UTF-8').splitlines()[0].split()[-1].strip()

it will output the version as:

test_elf.py(46)readelf_version()->'r3561M)'

which causes problems in this case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20180112/f1918318/attachment.html>


More information about the Reproducible-builds mailing list