On macOS, lcovutil.pm loads itself twice and warns "Subroutine ... redefined" for each subroutine
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start in lib/lcovutil.pm at the require LcovUtil call (line 20359 on master, 14192 in 2.6) and look at the check for lib/LcovUtil/blib that already guards the @INC entry. Reproduce with the two genhtml --version commands in the issue: the default run prints 442 redefined warnings, the LCOV_PURE_PERL=1 run prints none. Done means a run on a case-insensitive filesystem emits no warnings while still loading the extension when blib is present, so test both branches.
Written by the indexing model from the issue text.
Description
On macOS, whose default APFS filesystem is case-insensitive, every genhtml or lcov run from the 2.6 release prints a warning for each subroutine of lcovutil.pm, 442 of them:
Subroutine posix_path redefined at .../lcov-2.6/bin/../lib/LcovUtil.pm line 139.
Subroutine posix_paths redefined at .../lcov-2.6/bin/../lib/LcovUtil.pm line 164.
...
To reproduce on macOS (seen on macOS 27.2.1 with its /usr/bin/perl 5.34.1):
curl -LO https://github.com/linux-test-project/lcov/releases/download/v2.6/lcov-2.6.tar.gz
tar xzf lcov-2.6.tar.gz
lcov-2.6/bin/genhtml --version 2>&1 | grep -c redefined # 442
LCOV_PURE_PERL=1 lcov-2.6/bin/genhtml --version 2>&1 | grep -c redefined # 0
lib/lcovutil.pm tries the optional C++ extension with require LcovUtil (line 14192 in 2.6, line 20359 on master), which the release does not build. On a case-sensitive filesystem, that require fails and LCOV falls back to pure Perl, as intended. On a case-insensitive one, lib/LcovUtil.pm finds lib/lcovutil.pm, so Perl loads it a second time as LcovUtil.pm. That redefines every subroutine and runs its initialization again; $LcovUtil::XS_LOADED then stays undefined, so LCOV still falls back to pure Perl. The reports come out right, but behind hundreds of warnings.
LCOV_PURE_PERL=1 avoids it. A fix could require LcovUtil only when lib/LcovUtil/blib exists, which is already checked before adding it to @INC.
- Dominant language
- Shell
- Stars
- 1.1k
- Forks
- 272
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from linux-test-project/lcov
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
linux-test-project/lcov#546 · 4 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
linux-test-project/lcov#409 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
linux-test-project/lcov#376 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
linux-test-project/lcov#318 · 8 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
linux-test-project/lcov#284 · 11 comments ·
All issues in linux-test-project/lcov
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
docker/sbx-releases#911 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
🐳 docker 👩💻 DevOps API backend
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openfoodfacts/search-a-licious#613 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
nolabs-ai/nono-packs#70 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pingcap/monitoring#1284 ·
Maintainers usually reply within 1 day