Repository: mesonbuild/meson

Issue:
Unable to run code coverage report after upgrade to LCOV 2.0
**Describe the bug**
The coverage-html target fails with a Python traceback:

```
$ ninja coverage-html 
[1/1] Generates HTML coverage report
FAILED: meson-internal__coverage-html 
/usr/bin/meson --internal coverage --html /home/seb/gdev/tepl /home/seb/gdev/tepl/subprojects /home/seb/gdev/tepl/build /home/seb/gdev/tepl/build/meson-logs
lcov: LCOV version 2.0-1
genhtml: LCOV version 2.0-1
Capturing coverage data from /home/seb/gdev/tepl/build
geninfo cmd: '/usr/bin/geninfo /home/seb/gdev/tepl/build --output-filename /home/seb/gdev/tepl/build/meson-logs/coverage.info.initial --initial --memory 0'
Found gcov version: 13.1.1
Using intermediate gcov format
Writing temporary data to /tmp/geninfo_datUH3n
Scanning /home/seb/gdev/tepl/build for .gcno files ...
Found 92 graph files in /home/seb/gdev/tepl/build
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-encoding.p/test-encoding.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-language-chooser-widget.p/test-language-chooser-widget.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-language-chooser-dialog.p/test-language-chooser-dialog.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-fold-region.p/test-fold-region.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-stack-switcher-menu.p/test-stack-switcher-menu.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-tab.p/test-tab.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-gutter-renderer-folds.p/test-gutter-renderer-folds.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-gutter-renderer-folds.p/tepl-gutter-renderer-folds-sub.c.gcno
Processing /home/seb/gdev/tepl/build/tests/interactive-tests/test-space-drawer-prefs.p/test-space-drawer-prefs.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-view.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-view.p/test-view.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-encoding.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-encoding.p/test-encoding.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file.p/test-file.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-panel-item.p/test-panel-item.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-panel-item.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-fold-region.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-fold-region.p/test-fold-region.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-saver.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-saver.p/test-file-saver.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-notebook.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-notebook.p/test-notebook.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-icu.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-icu.p/test-icu.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-loader.p/test-file-loader.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-loader.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-info-bar.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-info-bar.p/test-info-bar.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata-manager.p/test-metadata-manager.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata-manager.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata.p/test-metadata.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-utils.p/tepl-test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-utils.p/test-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tests/other-tests/test-utils-gsettings.p/test-utils-gsettings.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-stack-switcher-menu.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-utils.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-label.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-goto-line-bar.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-overwrite-indicator.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-prefs.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata-manager.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-abstract-factory.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-io-error-info-bars.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-encoding-iconv.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-window-actions-edit.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file-loader.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-line-column-indicator.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-saving.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-icu.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-pango.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-notebook.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/meson-generated_.._tepl-enum-types.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-language-chooser-dialog.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata-parser.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-menu-shell.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-panel-item-simple.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-language-chooser.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file-saver.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-style-scheme-chooser-widget.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-group.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-view.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-panel1.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-loading.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file-chooser.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-buffer.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-info-bar.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata-attic.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-progress-info-bar.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-language-chooser-widget.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-space-drawer-prefs.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-statusbar.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-gutter-renderer-folds.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-window-actions-file.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-stack.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-application-window.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-iter.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-init.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-fold-region.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-stack-item.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-signal-group.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-panel-item.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-window-actions-search.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-close-confirm-dialog-single.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-application.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-encoding.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-prefs-dialog.c.gcno
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-settings.c.gcno
Finished .info-file creation
Capturing coverage data from /home/seb/gdev/tepl/build
geninfo cmd: '/usr/bin/geninfo /home/seb/gdev/tepl/build --output-filename /home/seb/gdev/tepl/build/meson-logs/coverage.info.run --no-checksum --rc lcov_branch_coverage=1 --memory 0 --branch-coverage'
geninfo: WARNING: RC option 'lcov_branch_coverage' is deprecated.  Consider using 'branch_coverage. instead.  (Backward-compatible support will be removed in the future
Found gcov version: 13.1.1
Using intermediate gcov format
Writing temporary data to /tmp/geninfo_datyq9t
Scanning /home/seb/gdev/tepl/build for .gcda files ...
Found 82 data files in /home/seb/gdev/tepl/build
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-view.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-view.p/test-view.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-encoding.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-encoding.p/test-encoding.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file.p/test-file.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-panel-item.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-panel-item.p/test-panel-item.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-fold-region.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-fold-region.p/test-fold-region.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-saver.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-saver.p/test-file-saver.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-notebook.p/test-notebook.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-notebook.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-icu.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-icu.p/test-icu.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-loader.p/test-file-loader.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-file-loader.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-info-bar.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-info-bar.p/test-info-bar.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata-manager.p/test-metadata-manager.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata-manager.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata.p/test-metadata.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-metadata.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-utils.p/tepl-test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tests/unit-tests/test-utils.p/test-utils.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-io-error-info-bars.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-signal-group.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-stack.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-icu.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-language-chooser.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-menu-shell.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-panel1.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-notebook.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-line-column-indicator.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-language-chooser-widget.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-buffer.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-panel-item.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-gutter-renderer-folds.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-iter.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-encoding.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-window-actions-search.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-overwrite-indicator.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-application-window.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-panel-item-simple.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-stack-item.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-group.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-stack-switcher-menu.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-encoding-iconv.c.gcda
geninfo: WARNING: /usr/include/glib-2.0/glib/gstrfuncs.h:321: unexecuted block on non-branch line with non-zero hit count.  Use "geninfo --rc geninfo_unexecuted_blocks=1 to set count to zero.
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-label.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata-manager.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-progress-info-bar.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/meson-generated_.._tepl-enum-types.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-window-actions-file.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file-saver.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-space-drawer-prefs.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-statusbar.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-pango.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file-chooser.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-loading.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file.c.gcda
geninfo: WARNING: /usr/include/glib-2.0/glib/gstrfuncs.h:321: unexecuted block on non-branch line with non-zero hit count.  Use "geninfo --rc geninfo_unexecuted_blocks=1 to set count to zero.
	(use "geninfo --ignore-errors gcov,gcov ..." to suppress this warning)
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-prefs.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-prefs-dialog.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-init.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-file-loader.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-window-actions-edit.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-tab-saving.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-info-bar.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-language-chooser-dialog.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata-parser.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-goto-line-bar.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-utils.c.gcda
geninfo: WARNING: /usr/include/glib-2.0/glib/gstrfuncs.h:321: unexecuted block on non-branch line with non-zero hit count.  Use "geninfo --rc geninfo_unexecuted_blocks=1 to set count to zero.
	(use "geninfo --ignore-errors gcov,gcov ..." to suppress this warning)
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-metadata-attic.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-settings.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-style-scheme-chooser-widget.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-close-confirm-dialog-single.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-application.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-view.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-fold-region.c.gcda
Processing /home/seb/gdev/tepl/build/tepl/libtepl-static.a.p/tepl-abstract-factory.c.gcda
Finished .info-file creation
lcov: WARNING: RC option 'lcov_branch_coverage' is deprecated.  Consider using 'branch_coverage. instead.  (Backward-compatible support will be removed in the future
Combining tracefiles.
.. found 2 files to aggregate.
Merging /home/seb/gdev/tepl/build/meson-logs/coverage.info.initial..1 remaining
Merging /home/seb/gdev/tepl/build/meson-logs/coverage.info.run..0 remaining
Writing data to /home/seb/gdev/tepl/build/meson-logs/coverage.info.raw
Summary coverage rate:
  lines......: 43.5% (3292 of 7560 lines)
  functions..: 49.7% (518 of 1042 functions)
  branches...: 24.8% (1223 of 4923 branches)
lcov: WARNING: RC option 'lcov_branch_coverage' is deprecated.  Consider using 'branch_coverage. instead.  (Backward-compatible support will be removed in the future
Excluding /usr/include/glib-2.0/glib/gstrfuncs.h
Excluding /usr/include/glib-2.0/glib/gstring.h
Excluding /usr/include/glib-2.0/gobject/gobject.h
Excluding /usr/include/gtk-3.0/gtk/gtknativedialog.h
Removed 4 files
Writing data to /home/seb/gdev/tepl/build/meson-logs/coverage.info
Summary coverage rate:
  lines......: 43.3% (3254 of 7516 lines)
  functions..: 49.7% (515 of 1037 functions)
  branches...: 26.5% (1194 of 4511 branches)
lcov: WARNING: RC option 'lcov_branch_coverage' is deprecated.  Consider using 'branch_coverage. instead.  (Backward-compatible support will be removed in the future
lcov: ERROR: 'exclude' pattern '/home/seb/gdev/tepl/subprojects/*' is unused.
	(use "lcov --ignore-errors unused ..." to bypass this error)
Removed 0 files
Writing data to /home/seb/gdev/tepl/build/meson-logs/coverage.info
Summary coverage rate:
  lines......: 43.3% (3254 of 7516 lines)
  functions..: 49.7% (515 of 1037 functions)
  branches...: 26.5% (1194 of 4511 branches)
Traceback (most recent call last):
  File "/usr/bin/meson", line 5, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/mesonbuild/mesonmain.py", line 294, in main
    return run(sys.argv[1:], launcher)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mesonbuild/mesonmain.py", line 282, in run
    return run_script_command(args[1], args[2:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mesonbuild/mesonmain.py", line 223, in run_script_command
    return module.run(script_args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mesonbuild/scripts/coverage.py", line 197, in run
    return coverage(options.outputs, options.source_root,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mesonbuild/scripts/coverage.py", line 136, in coverage
    subprocess.check_call([lcov_exe,
  File "/usr/lib64/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lcov', '--remove', '/home/seb/gdev/tepl/build/meson-logs/coverage.info', '/home/seb/gdev/tepl/subprojects/*', '--rc', 'lcov_branch_coverage=1', '--output-file', '/home/seb/gdev/tepl/build/meson-logs/coverage.info']' returned non-zero exit status 25.
ninja: build stopped: subcommand failed.
```

**system parameters**
* what operating system: openSUSE Tumbleweed
* what Python version: Python 3.11.4
* what `meson --version`: 1.1.1
* what `ninja --version` if it's a Ninja build: 1.11.1



Discussion:
```
subprocess.CalledProcessError: Command '['lcov', '--remove', '/home/seb/gdev/tepl/build/meson-logs/coverage.info', '/home/seb/gdev/tepl/subprojects/*', '--rc', 'lcov_branch_coverage=1', '--output-file', '/home/seb/gdev/tepl/build/meson-logs/coverage.info']' returned non-zero exit status 25.
```

So the question is, why does `lcov --remove` return an error? The coverage target runs several lcov commands in order, and I'm unfamiliar with lcov itself, so is this:
```
lcov: ERROR: 'exclude' pattern '/home/seb/gdev/tepl/subprojects/*' is unused.
	(use "lcov --ignore-errors unused ..." to bypass this error)
```

part of the failing --remove command? Seems plausible.
> lcov: LCOV version 2.0-1
> genhtml: LCOV version 2.0-1

Downgrading to lcov version 1.16 fixes the problem.

lcov version 2.0 was released in May 2023, so it is quite recent.
I'm getting the same error and problem, sadly I cannot downgrade lcov.
```
lcov: LCOV version 2.0-1
genhtml: LCOV version 2.0-1
```

Resolving patch:
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -640,7 +640,7 @@ def generate(self, capture: bool = False, vslite_ctx: dict = None) -> T.Optional
             key = OptionKey('b_coverage')
             if (key in self.environment.coredata.options and
                     self.environment.coredata.options[key].value):
-                gcovr_exe, gcovr_version, lcov_exe, genhtml_exe, _ = environment.find_coverage_tools()
+                gcovr_exe, gcovr_version, lcov_exe, lcov_version, genhtml_exe, _ = environment.find_coverage_tools()
                 if gcovr_exe or (lcov_exe and genhtml_exe):
                     self.add_build_comment(NinjaComment('Coverage rules'))
                     self.generate_coverage_rules(gcovr_exe, gcovr_version)
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -96,6 +96,20 @@ def detect_gcovr(min_version: str = '3.3', log: bool = False):
         return gcovr_exe, found
     return None, None
 
+def detect_lcov(log: bool = False):
+    lcov_exe = 'lcov'
+    try:
+        p, found = Popen_safe([lcov_exe, '--version'])[0:2]
+    except (FileNotFoundError, PermissionError):
+        # Doesn't exist in PATH or isn't executable
+        return None, None
+    found = search_version(found)
+    if p.returncode == 0 and found:
+        if log:
+            mlog.log('Found lcov-{} at {}'.format(found, quote_arg(shutil.which(lcov_exe))))
+        return lcov_exe, found
+    return None, None
+
 def detect_llvm_cov():
     tools = get_llvm_tool_names('llvm-cov')
     for tool in tools:
@@ -103,20 +117,18 @@ def detect_llvm_cov():
             return tool
     return None
 
-def find_coverage_tools() -> T.Tuple[T.Optional[str], T.Optional[str], T.Optional[str], T.Optional[str], T.Optional[str]]:
+def find_coverage_tools() -> T.Tuple[T.Optional[str], T.Optional[str], T.Optional[str], T.Optional[str], T.Optional[str], T.Optional[str]]:
     gcovr_exe, gcovr_version = detect_gcovr()
 
     llvm_cov_exe = detect_llvm_cov()
 
-    lcov_exe = 'lcov'
+    lcov_exe, lcov_version = detect_lcov()
     genhtml_exe = 'genhtml'
 
-    if not mesonlib.exe_exists([lcov_exe, '--version']):
-        lcov_exe = None
     if not mesonlib.exe_exists([genhtml_exe, '--version']):
         genhtml_exe = None
 
-    return gcovr_exe, gcovr_version, lcov_exe, genhtml_exe, llvm_cov_exe
+    return gcovr_exe, gcovr_version, lcov_exe, lcov_version, genhtml_exe, llvm_cov_exe
 
 def detect_ninja(version: str = '1.8.2', log: bool = False) -> T.List[str]:
     r = detect_ninja_command_and_version(version, log)
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -22,7 +22,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
     outfiles = []
     exitcode = 0
 
-    (gcovr_exe, gcovr_version, lcov_exe, genhtml_exe, llvm_cov_exe) = environment.find_coverage_tools()
+    (gcovr_exe, gcovr_version, lcov_exe, lcov_version, genhtml_exe, llvm_cov_exe) = environment.find_coverage_tools()
 
     # load config files for tools if available in the source tree
     # - lcov requires manually specifying a per-project config
@@ -35,6 +35,11 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
     else:
         lcov_config = []
 
+    if lcov_exe and mesonlib.version_compare(lcov_version, '>=2.0'):
+        lcov_exe_rc_branch_coverage = ['--rc', 'branch_coverage=1']
+    else:
+        lcov_exe_rc_branch_coverage = ['--rc', 'lcov_branch_coverage=1']
+
     gcovr_config = ['-e', re.escape(subproject_root)]
 
     # gcovr >= 4.2 requires a different syntax for out of source builds
@@ -90,6 +95,9 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
             initial_tracefile = covinfo + '.initial'
             run_tracefile = covinfo + '.run'
             raw_tracefile = covinfo + '.raw'
+            lcov_subpoject_exclude = []
+            if os.path.exists(subproject_root):
+                lcov_subpoject_exclude.append(os.path.join(subproject_root, '*'))
             if use_llvm_cov:
                 # Create a shim to allow using llvm-cov as a gcov tool.
                 if mesonlib.is_windows():
@@ -117,26 +125,26 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
                                    '--capture',
                                    '--output-file', run_tracefile,
                                    '--no-checksum',
-                                   '--rc', 'lcov_branch_coverage=1'] +
+                                   *lcov_exe_rc_branch_coverage] +
                                   lcov_config +
                                   gcov_tool_args)
             # Join initial and test results.
             subprocess.check_call([lcov_exe,
                                    '-a', initial_tracefile,
                                    '-a', run_tracefile,
-                                   '--rc', 'lcov_branch_coverage=1',
+                                   *lcov_exe_rc_branch_coverage,
                                    '-o', raw_tracefile] + lcov_config)
             # Remove all directories outside the source_root from the covinfo
             subprocess.check_call([lcov_exe,
                                    '--extract', raw_tracefile,
                                    os.path.join(source_root, '*'),
-                                   '--rc', 'lcov_branch_coverage=1',
+                                   *lcov_exe_rc_branch_coverage,
                                    '--output-file', covinfo] + lcov_config)
             # Remove all directories inside subproject dir
             subprocess.check_call([lcov_exe,
                                    '--remove', covinfo,
-                                   os.path.join(subproject_root, '*'),
-                                   '--rc', 'lcov_branch_coverage=1',
+                                   *lcov_subpoject_exclude,
+                                   *lcov_exe_rc_branch_coverage,
                                    '--output-file', covinfo] + lcov_config)
             subprocess.check_call([genhtml_exe,
                                    '--prefix', build_root,


Test patch: