Coverage with make coverage-html is broken on latest Debian using lcov v2

From: Narek Galstyan <narek(dot)galstyan(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "narekg(at)berkeley(dot)edu" <narekg(at)berkeley(dot)edu>, ngalstyan4(at)gmail(dot)com
Subject: Coverage with make coverage-html is broken on latest Debian using lcov v2
Date: 2026-04-21 14:36:11
Message-ID: CAHsn6_xCDQWe8_vVFhtFk27_xTdyVV+Dr0yWzaooBZ6+-VH-5w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

On Debian 13 (trixie), `make coverage-html` command triggers an lcov
failure.
There have been past reports of this failure in pgsql-hackers here
<https://www.postgresql.org/message-id/202602261231.mlk2icrqrwpw%40alvherre.pgsql>
.

APT package repositories on Debian 13 default to lcov v2 (2.3.1-1) which
is stricter about a few warnings and triggers an error. This commit
<https://github.com/linux-test-project/lcov/commit/5f659f63801ef7f94c50a0eb5cffa1ea70f73651>in
lcov details some of the changes for lcov v2, including the stricter error
handling (see bullet b)).

After applying the attached patches to the current master branch, `make
coverage-html` starts working with lcov v2.

---

More details:

Without applying any of the patches, with --enable-coverage and in-tree
build (no vpath), make check && make coverage-html results in the following
error:

```
/usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -i -d . -d . -o
lcov_base.info
lcov: ERROR: (usage) duplicate file ./src/backend/access/table/tableam.gcno
in both . and .
(use "lcov --ignore-errors usage ..." to bypass this error)
Message summary:
1 error message:
usage: 1
make: *** [src/Makefile.global:1064: lcov_base.info] Error 1
```

After applying the first patch, I get this error:

```

genhtml: ERROR: (corrupt) unable to read trace file 'lcov_base.info':
genhtml: ERROR: (inconsistent) "lcov_base.info":507880: duplicate function
'blockreftable_create' starts on line
"/home/admin/postgres/src/include/lib/simplehash.h":450 but previous
definition started on 447 while merging lcov_base.info while loading
lcov_base.info.
(use "genhtml --ignore-errors inconsistent ..." to bypass this
error)
(use "genhtml --ignore-errors corrupt ..." to bypass this error)
make: *** [src/Makefile.global:1055: coverage-html-stamp] Error 1

```

With the other 2 patches also applied, make check && make coverage-html
starts producing proper reports.
I tested `make coverage-html` on Debian 13 with lcov v1 and everything
worked there as well.

Narek
--

Attachment Content-Type Size
0003-Regenerate-configure-after-make-coverage-html-fixes-.patch application/octet-stream 956 bytes
0002-Add-minimal-lcov-ignore-errors-flags-to-avoid-make-c.patch application/octet-stream 2.3 KB
0001-Fix-lcov-duplicate-directory-error-for-non-vpath-bui.patch application/octet-stream 1.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-04-21 14:42:25 Re: Two issues leading to discrepancies in FSM data on the standby server
Previous Message Andrew Dunstan 2026-04-21 14:20:22 Re: Non-robust plpgsql_trap test