rizsotto / scan-build

Clang's scan-build re-implementation in python
Other
362 stars 34 forks source link

AssertionError when files have disappeared from the build but are still present in compilation database #86

Closed tanuva closed 7 years ago

tanuva commented 7 years ago

Hello,

I'm a very happy scan-build user (Thank you!) with a tiny issue. It happens here and there that a cpp file is removed from the project I'm working on. On the next compilation run with intercept-build --append and a big existing database, this backtrace is emitted after the build finished - so I assume this happens when updating compilation_database.json.

Traceback (most recent call last):
  File "/usr/local/bin/intercept-build", line 11, in <module>
    load_entry_point('scan-build==2.0.6', 'console_scripts', 'intercept-build')()
  File "/usr/local/lib/python3.6/site-packages/scan_build-2.0.6-py3.6.egg/libscanbuild/__init__.py", line 117, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/scan_build-2.0.6-py3.6.egg/libscanbuild/intercept.py", line 58, in intercept_build
    entries = iter(set(itertools.chain(previous, current)))
  File "/usr/local/lib/python3.6/site-packages/scan_build-2.0.6-py3.6.egg/libscanbuild/compilation.py", line 256, in load
    yield Compilation.from_db_entry(entry)
  File "/usr/local/lib/python3.6/site-packages/scan_build-2.0.6-py3.6.egg/libscanbuild/compilation.py", line 127, in from_db_entry
    assert len(entries) == 1
AssertionError

If I remove the database entry for the deleted cpp file manually, the build works as expected again.

rizsotto commented 7 years ago

Thanks Marcel for the report. It's a bug, you are correct. Will try to fix it.

tanuva commented 7 years ago

Whoa, that was quick, thanks!