Skip to content

perl debug_prints counts sprintf, which formats a string and prints nothing #3340

Closed

Description

@squid-protocol

Problem

perl's debug_prints rule matches sprintf, which formats a string and prints nothing:

sub macro_ref { my($name) = (@_); return sprintf('$(%s)', $name); }

spamassassin/Makefile.PL::macro_ref is counted as a debug print, and because it's a short branchless helper with 10 call sites, the #3313 wrapper channel records it as a debug_prints wrapper. It's one of the residual false positives recorded in tests/tools/wrapper_labels.json.

Among registry languages, only perl's debug_prints rule matches sprintf(. The C family's rule is \b(printf|fprintf|vprintf|puts|putchar|perror)\b, which excludes it.

Fix

Drop sprintf from perl's debug_prints. Keep printf, print, warn and say, which do write output. debug_prints is still a draft contract row, so do this with the rule's contract audit or as a one-line rule fix with a golden-master check.

Found during epic #3313, step 1 (#3315).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing engine

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions