Skip to content

fix(cpan-tester): initialize $KILL_AFTER before main execution#574

Merged
fglock merged 1 commit intomasterfrom
fix/cpan-tester-kill-after-init
Apr 27, 2026
Merged

fix(cpan-tester): initialize $KILL_AFTER before main execution#574
fglock merged 1 commit intomasterfrom
fix/cpan-tester-kill-after-init

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 27, 2026

Summary

perl dev/tools/cpan_random_tester.pl --count N has been broken since #573 (commit 1ef073e). Every test reported [No parseable output] because $KILL_AFTER was undef.

Root cause

#573 added:

my $KILL_AFTER = 10;  # seconds between SIGTERM and SIGKILL
sub run_with_timeout { ... "$timeout_cmd -k ${KILL_AFTER}s ${secs}s $cmd 2>&1" ... }

at line ~502, but run_with_timeout is invoked from main-line code at line 195 — well before execution reaches line 502 — so the assignment hadn't run yet and $KILL_AFTER was undef on every call.

The script printed:

Use of uninitialized value $KILL_AFTER in concatenation (.) or string at dev/tools/cpan_random_tester.pl line 509.

and the resulting timeout -k s 300s ... was rejected by timeout, so jcpan was never actually invoked and every module was scored FAIL [No parseable output].

Fix

Move the my $KILL_AFTER = 10; declaration up to the other file-scope my declarations so it's initialized before any call site.

Test plan

  • perl dev/tools/cpan_random_tester.pl --count 1 — no more uninitialized warning, jcpan actually runs
  • make passes

Generated with Devin

Commit 1ef073e declared `my $KILL_AFTER = 10;` immediately above
`sub run_with_timeout` (line 502), but `run_with_timeout` is called
from main-line code at line 195 — long before execution reaches the
declaration. As a result $KILL_AFTER was undef on every call,
producing:

  Use of uninitialized value $KILL_AFTER in concatenation (.) or
  string at dev/tools/cpan_random_tester.pl line 509.

The resulting command `timeout -k s 300s ...` was rejected by
`timeout`, so every module reported `[No parseable output]` and the
whole `--count N` run was useless.

Move the declaration up next to the other file-scope `my` vars so
it's initialized before any call site.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit 3219b36 into master Apr 27, 2026
2 checks passed
@fglock fglock deleted the fix/cpan-tester-kill-after-init branch April 27, 2026 14:11
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.

1 participant