Skip to content

error tracebacks are hidden and replaced by impossible-to-debug messages

Eli Schwartz requested to merge comparators-importerror into master

See https://bugs.archlinux.org/task/59011 for an example of why this is bad.

A dependent package of diffoscope had a bug, but when diffoscope tried to import diffoscope.comparators.deb.Md5sumsFile and got a

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/diffoscope/comparators/deb.py",
line 27, in <module>
    from .tar import TarContainer
  File "/usr/lib/python3.6/site-packages/diffoscope/comparators/tar.py",
line 25, in <module>
    from .utils.libarchive import LibarchiveContainer, list_libarchive
  File
"/usr/lib/python3.6/site-packages/diffoscope/comparators/utils/libarchive.py",
line 25, in <module>
    import libarchive
ModuleNotFoundError: No module named 'libarchive'

in return, it ate the error and replaced it with

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/diffoscope/main.py", line 452,
in main
    sys.exit(run_diffoscope(parsed_args))
  File "/usr/lib/python3.6/site-packages/diffoscope/main.py", line 424,
in run_diffoscope
    difference = compare_root_paths(path1, path2)
  File
"/usr/lib/python3.6/site-packages/diffoscope/comparators/utils/compare.py",
line 65, in compare_root_paths
    file1 = specialize(FilesystemFile(path1, container=container1))
  File
"/usr/lib/python3.6/site-packages/diffoscope/comparators/utils/specialize.py",
line 48, in specialize
    for cls in ComparatorManager().classes:
  File
"/usr/lib/python3.6/site-packages/diffoscope/comparators/__init__.py",
line 104, in __init__
    self.reload()
  File
"/usr/lib/python3.6/site-packages/diffoscope/comparators/__init__.py",
line 125, in reload
    ', '.join(xs)
ImportError: Could not import deb.Md5sumsFile

This is quite confusing and we should avoid eating errors

Merge request reports

Loading