You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build something with --coverage enabled, and then use lcov to produce some foo.info file from its foo.gcno files
Expected behavior
Tool works, foo.info produced
Actual behavior
lcov --rc lcov_branch_coverage=1 --directory . --capture --initial -o app_base.info
Capturing coverage data from .
Found gcov version: 13.2.0
Using intermediate gcov format
Using JSON module JSON::PP
Scanning . for .gcno files ...
Found 10 graph files in .
Processing build\test-array.gcno
geninfo: ERROR: ERROR: Could not copy file C:\msys64\home\ellie\source\ships\build\test-array.gcno!
geninfo is trying to copy the original foo.gcno file to a temporary working location, but it incorrectly computes the destination path as something like "/tmp/whatever/C:\real\windows\path\foo.gcno", which then gets rejected by the copy operation (presumably because of the :), leading to the error above
The problem is in its split_filename() function. It splits the path only on '/', which means instead of correctly separating out the directory, basename, and extension, it instead produces an empty directory, the entire windows path in the basename, and the correct extension. The caller then constructs the destination path from tmp + basename + extension, and you can see the result.
The fix is trivial, this is what I have changed on my system:
--- /ucrt64/bin/geninfo.orig 2024-04-06 14:47:14.138205400 +1100
+++ /ucrt64/bin/geninfo 2024-04-06 15:17:43.820164000 +1100
@@ -1690,7 +1690,7 @@
sub split_filename($)
{
- my @path_components = split('/', $_[0]);
+ my @path_components = split(/[\\\/]/, $_[0]);
my @file_components = split('\.', pop(@path_components));
my $extension = pop(@file_components);
With that change (splitting paths on either back- or forward-slash), it works as expected. Hopefully this is useful to someone
Description / Steps to reproduce the issue
Build something with --coverage enabled, and then use lcov to produce some foo.info file from its foo.gcno files
Expected behavior
Tool works, foo.info produced
Actual behavior
geninfo is trying to copy the original foo.gcno file to a temporary working location, but it incorrectly computes the destination path as something like "/tmp/whatever/C:\real\windows\path\foo.gcno", which then gets rejected by the copy operation (presumably because of the
:
), leading to the error aboveThe problem is in its
split_filename()
function. It splits the path only on'/'
, which means instead of correctly separating out the directory, basename, and extension, it instead produces an empty directory, the entire windows path in the basename, and the correct extension. The caller then constructs the destination path from tmp + basename + extension, and you can see the result.The fix is trivial, this is what I have changed on my system:
With that change (splitting paths on either back- or forward-slash), it works as expected. Hopefully this is useful to someone
Verification
Windows Version
MSYS_NT-10.0-19045
Are you willing to submit a PR?
patch included
The text was updated successfully, but these errors were encountered: