Skip to content

fix: suppress uninitialized warning in pod2man when Makefile is absent#481

Draft
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Koan-Bot:koan.atoomic/fix-issue-479
Draft

fix: suppress uninitialized warning in pod2man when Makefile is absent#481
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Koan-Bot:koan.atoomic/fix-issue-479

Conversation

@Koan-Bot
Copy link

@Koan-Bot Koan-Bot commented Mar 19, 2026

Summary

ExtUtils::Command::MM::pod2man compares the man page mtime against the hardcoded file "Makefile" to decide whether to skip regeneration. When that file does not exist (e.g. FIRST_MAKEFILE renames it, or during sandbox/out-of-tree builds like ZoneMinder on Gentoo), mtime() returns undef and Perl emits many warnings:

Use of uninitialized value in numeric gt (>) at .../Command/MM.pm line 147.

Using // 0 treats a missing makefile as having mtime 0 — the correct semantic (man page is trivially newer than a non-existent baseline), with no warning.

Fixes #479

Changes

  • lib/ExtUtils/Command/MM.pm: change mtime("Makefile") to (mtime("Makefile") // 0) on the skip-check line
  • t/pod2man.t: add regression test that verifies no uninitialized-value warnings are emitted when Makefile is absent

Test plan

  • New test in t/pod2man.t creates a temp directory without a Makefile, puts a pod source and an up-to-date man page there, calls pod2man(), and asserts zero uninitialized-value warnings
  • prove -l t/pod2man.t t/eu_command.t passes cleanly

Generated by Kōan /fix


Quality Report

Changes: 2 files changed, 46 insertions(+), 2 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

When pod2man checks whether a man page is up-to-date it compares the
man page mtime against the hardcoded file "Makefile".  If that file
does not exist (e.g. when FIRST_MAKEFILE renames it, or during
out-of-tree builds like ZoneMinder on Gentoo), stat() returns an empty
list and mtime() returns undef, triggering:

  Use of uninitialized value in numeric gt (>) at .../Command/MM.pm line 147.

Use "// 0" to treat a missing makefile as having mtime 0, which is the
correct semantic: a non-existent baseline means the man page is
trivially newer than it, so the skip logic still works correctly while
the warning is eliminated.

Fixes Perl-Toolchain-Gang#479
next if ((-e $man) &&
(mtime($man) > mtime($pod)) &&
(mtime($man) > mtime("Makefile")));
(mtime($man) > (mtime("Makefile") // 0)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's appropriate to make EUMM require 5.10 for a trivial line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MM.pm emits uninitialized value warnings for missing or non-standard Makefiles

2 participants