Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD
Hi Guangyuan, > When 'unknown' and '2.29' passed in, LooseVersion will fail What's really odd is that I could have sworn I already pushed this! Indeed, my working tree already had the fixed code, just not committed :) Anyway, done that now: https://anonscm.debian.org/git/reproducible/diffoscope.git/commit/?id=34b54b496b64fceebd60e984445b7e0e9fda9312 Thanks for the follow-up. Best wishes, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD
2018-01-16 13:05 GMT+08:00 Guangyuan Yang: > Hi Chris, > > It still exists. Here is some investigation inside decorator > `skip_if_tool_version_is` For now, change the line + if m is None: + return 'unknown' to + if m is None: + return '0.00' in https://anonscm.debian.org/git/reproducible/diffoscope.git/commit/?id=304660a54a433ff65ce0cef986b22b3d76793ab0 will solve the issue.
Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD
2018-01-12 2:36 GMT-05:00 Chris Lamb: > [Re-adding the bug to CC - please retain in future] > > Hi Guangyuan, > >> The error still exists > > This should fix it: > > > https://anonscm.debian.org/git/reproducible/diffoscope.git/commit/?id=304660a54a433ff65ce0cef986b22b3d76793ab0 Hi Chris, It still exists. Here is some investigation inside decorator `skip_if_tool_version_is` platform freebsd11 -- Python 3.6.4, pytest-3.2.5, py-1.5.2, pluggy-0.4.0 -- /usr/local/bin/python3 cachedir: .cache rootdir: /usr/home/guangyuan/diffoscope, inifile: collecting 162 items > PDB set_trace (IO-capturing > turned off) > >> (Pdb) s > /usr/home/guangyuan/diffoscope/tests/utils/tools.py(47)skip_if_tool_version_is() -> vcls(str(actual_ver)) == vcls(str(target_ver)), (Pdb) actual_ver 'unknown' (Pdb) target_ver '2.29' (Pdb) vcls(str(actual_ver)) LooseVersion ('unknown') (Pdb) vcls(str(target_ver)) LooseVersion ('2.29') (Pdb) vcls(str(actual_ver)) == vcls(str(target_ver)) *** TypeError: '<' not supported between instances of 'str' and 'int' When 'unknown' and '2.29' passed in, LooseVersion will fail. Actually, it seems that LooseVersion does not handle such situation: ➜ ~ python3 Python 3.6.3 (default, Oct 3 2017, 21:45:48) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from distutils.version import LooseVersion >>> LooseVersion('1') == LooseVersion('a') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/distutils/version.py", line 46, in __eq__ c = self._cmp(other) File "/usr/lib/python3.6/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'int' and 'str'
Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD
[Re-adding the bug to CC - please retain in future] Hi Guangyuan, > The error still exists This should fix it: https://anonscm.debian.org/git/reproducible/diffoscope.git/commit/?id=304660a54a433ff65ce0cef986b22b3d76793ab0 Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD
tags 886963 + pending thanks Thanks Guangyuan! Fixed in Git: https://anonscm.debian.org/git/reproducible/diffoscope.git/commit/?id=304660a54a433ff65ce0cef986b22b3d76793ab0 Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
Bug#886963: Diffoscope: different readelf implementations cause version parsing errors on FreeBSD
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 @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.