Skip to content

Commit 25ff79c

Browse files
committed
geninfo: Add workaround for MSYS GCC problem
Some versions of MSYS GCC include support for generating JSON intermediate output format but incorrectly encode backslashes as \n: $ gcov -i example.gcda -t { "gcc_version": "9.2.0", [...] "current_working_directory": "C:\nTemp\nlcov\nexample", "data_file": "example.gcda" } This causes geninfo to abort when trying to collect coverage data: Processing example.gcda geninfo: Unsuccessful open on filename containing newline at bin/geninfo line 2905. geninfo: WARNING: could not open C: Temp lcov example/example.c Fix this by converting newlines in filenames on MSYS to /. Signed-off-by: Peter Oberparleiter <[email protected]> Reported-by: [email protected]
1 parent d666bae commit 25ff79c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bin/geninfo

+6
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,12 @@ sub read_intermediate_json($$$)
21602160

21612161
$$basedir_ref = $json->{"current_working_directory"};
21622162

2163+
# Workaround for bug in MSYS GCC 9.x that encodes \ as \n in gcov JSON
2164+
# output
2165+
if ($^O eq "msys" && $$basedir_ref =~ /\n/) {
2166+
$$basedir_ref =~ s#\n#/#g;
2167+
}
2168+
21632169
for my $file (@{$json->{"files"}}) {
21642170
my $filename = $file->{"file"};
21652171

0 commit comments

Comments
 (0)