mozilla / grcov

Rust tool to collect and aggregate code coverage data for multiple source files
Mozilla Public License 2.0
1.17k stars 148 forks source link

gcov detection fails on Windows if version is found at end of line #1189

Open mitchgrout opened 2 months ago

mitchgrout commented 2 months ago

gcov::parse_version currently splits words using either whitepace or newlines, but does not account for carriage returns. This can lead to failures to detect valid gcov binaries on Windows. Example using the w64devkit bundled version of gcov:

$ gcov --version | head -n1
gcov (GCC) 14.1.0

$ gcov --version | head -n1 | xxd -c20
00000000: 6763 6f76 2028 4743 4329 2031 342e 312e 300d 0a    gcov (GCC) 14.1.0..

The gathered versions are ["gcov", "(GCC)", "14.1.0<CR>"], all of which fail Version::parse

This could be fixed by adding '\r' into this list, or by using char.is_whitespace or char.is_ascii_whitespace

feo-elektronik-may commented 1 month ago

This is a duplicate of #919, and a fix is already available in #1179. I chose to trim away all whitespace in version number candidates instead of adding any special logic for \r or modifying the splitting logic.

Unfortunately, it seems like this project is not getting maintained right now, so the PR has been open for 3 months without any feedback already.