Skip to content

perl func_start: POD documentation blocks (=head1/=cut) are never stripped, so code examples inside POD are matched as real subroutines #2239

Closed

Description

@squid-protocol

Found during a tri-comparison ledger sweep of perl/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter] (and its stale 2-tool sibling agree[gitgalaxy]_vs[tree_sitter]).

Confirmed real, currently-reproducing GitGalaxy false positive. mojo/Promise.pm:262 is 1; (end of real module code). Line 264 opens =encoding utf8 / =head1 NAME / =head1 SYNOPSIS POD documentation, with no =cut until line 550. sub get_p { ... } at line 277 sits inside the SYNOPSIS block's illustrative code example — it's documentation/prose, not a real subroutine in this module. tree-sitter and ctags both correctly treat POD as non-code and report no such function; GitGalaxy's func_start matches it as if it were real.

Root cause: GitGalaxy has zero POD-block awareness for Perl. This is already an acknowledged, documented gap — both gitgalaxy/standards/language_standards.py:7759-7761 and gitgalaxy/core/detector.py:2535-2537 explicitly say "POD blocks (=head/=cut) are never stripped from this stream at all... Known remaining gap, not fixed here." That's the same root cause as closed issue #1606, which fixed the mirror false-negative symptom (a POD apostrophe corrupting the brace-shield and causing a real function to be missed). This issue is the false-positive symptom of the identical gap: literal sub name { ... } example code inside a POD block gets counted as a real function.

Suggested fix: strip =head1...=cut (and other =-prefixed POD directive blocks) from the code stream the same way comments/strings are already shielded in prism.py, before func_start (and other signatures) run — the general fix this gap has been deferred on since at least #1606.

Activity

  1. added
    bug
    core-engine
    threat: false-positive
    on Aug 26, 2026
  2. added this to the v2.4.9 milestone on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginethreat: false-positive

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions