Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception parsing files containing: "-: 0:Source is newer than graph" #632

Closed
SamCastelain opened this issue Jun 13, 2022 · 3 comments

Comments

@SamCastelain
Copy link

Describe the bug
gcovr crashes with an uncaught exception when parsing a gcov file containing this line:

-: 0:Source is newer than graph

To Reproduce
Steps to reproduce the behavior:

  1. Update the timestamp of a file after the gcda file for it was created.
  2. Run gcovr

Alternatively you could alter a .gcov file to contain that line.

Expected behavior
gcovr should of course not crash in this scenario, because that makes it difficult to know what went wrong. I'm fine with gcovr exiting with printing an error in this scenario, but that's up to you to decide. This issue did expose an issue in my build environment that I resolved now to avoid those lines happening, so there's no rush to fix this. But for the general community I think it would be better to have this fixed.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: ubuntu 22.04
  • GCC version: 11.2.0
  • GCOVR version: 5.1
  • Project directory layout:
    • Roots: ./
    • Object directories: build/**

Additional context
Stacktrace:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/gcovr/workers.py", line 77, in worker
work(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/gcovr/gcov.py", line 317, in process_datafile
done = run_gcov_and_process_files(
File "/usr/local/lib/python3.10/dist-packages/gcovr/gcov.py", line 490, in run_gcov_and_process_files
process_gcov_data(fname, covdata, abs_filename, options)
File "/usr/local/lib/python3.10/dist-packages/gcovr/gcov.py", line 100, in process_gcov_data
metadata = parse_metadata(lines)
File "/usr/local/lib/python3.10/dist-packages/gcovr/gcov_parser.py", line 226, in parse_metadata
parsed_line = _parse_line(line)
File "/usr/local/lib/python3.10/dist-packages/gcovr/gcov_parser.py", line 724, in _parse_line
key, value = source_code.split(":", 1)

@Spacetown
Copy link
Member

This is a duplicate of #596 and solved on master with #601.
Please use the latest version from Git or use version 5.0 until the fix is released.

@SamCastelain
Copy link
Author

Sorry, I only searched through the open issues, my bad.

@Spacetown
Copy link
Member

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants