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

Use os.path.commonpath in guess_source_filename #299

clynamen opened this issue Mar 14, 2019 · 1 comment

Use os.path.commonpath in guess_source_filename #299

clynamen opened this issue Mar 14, 2019 · 1 comment


Copy link

@clynamen clynamen commented Mar 14, 2019

common_dir = os.path.commonprefix([data_fname, currdir])

I ran into an error where not-existing filename where generated due to common prefix. Indeed this function will return an invalid directory in this case


it will result in directory /cygdrive/my due to the fact that commonprefix return the prefix string instead of the prefix path

I think the proper function to use here is

A similar issue caused #52

Copy link

@latk latk commented Mar 14, 2019

Thank you for finding that! Historically, the problem is that gcovr still supports Python 2.7 which doesn't have a commonpath() function in the standard library, we therefore have a custom implementation in the gcovr.util module.

I'll fix this right away!

@latk latk added the Type: Bug label Mar 14, 2019
@latk latk closed this in 026b00c Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants