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

parse_gcov assumes that produced source file names are escaped regular expressions #459

Open
hsloot opened this issue Dec 12, 2020 · 1 comment

Comments

@hsloot
Copy link
Contributor

hsloot commented Dec 12, 2020

The function parse_gcov tries to skip all files for which source_file is not below root package_path. It does that by using a regular expression.

if (!file.exists(source_file) || !grepl(rex::rex(start, rex::regex(paste0(package_path, collapse = "|"))), source_file)) {

However, rex::regex assumes that the given expression is already an escaped regular expression. That might not be always the case - MacOS is allowing almost all Unicode characters in filenames. In my case, a parent folder contains a "+" (that, unfortunately, cannot be changed).

The effects might vary, but I guess in most cases, the files are simply ignored such that no reports on compiled files are returned.

It should be able to solve this by replacing the relevant expression with

grepl(rex::rex(start, rex::regex(paste0(rex::escape(package_path), collapse = "|"))), source_file)

Possible link to #448.

@hsloot hsloot changed the title parse_gcov assumes that produces source file names are escaped regular expressions parse_gcov assumes that produced source file names are escaped regular expressions Dec 12, 2020
@jimhester
Copy link
Member

Yes, your fix looks correct, would you be interested in submitting a pull request to fix this?

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

No branches or pull requests

2 participants