Skip to content

fix: uninitialized value warnings in parsers()#57

Draft
toddr-bot wants to merge 2 commits intoTux:masterfrom
toddr-bot:koan.toddr.bot/fix-issue-55
Draft

fix: uninitialized value warnings in parsers()#57
toddr-bot wants to merge 2 commits intoTux:masterfrom
toddr-bot:koan.toddr.bot/fix-issue-55

Conversation

@toddr-bot
Copy link
Copy Markdown

@toddr-bot toddr-bot commented Mar 21, 2026

Summary

Fix "Use of uninitialized value in string eq" warnings in parsers() that occur when $@ from a failed require contains embedded newlines (e.g., on FreeBSD). The grep filter regex ^(?:dmp|ios|!.*)$ fails to match multiline error strings because . doesn't match newlines, allowing modified parser entries to leak through.

Fixes #55

Changes

  • Simplify grep regex from m{^(?:dmp|ios|!.*)$} to m{^(?:dmp|ios|!)} — only the prefix check matters, and this is immune to newline issues in $@
  • Add // "" guard on $can{$typ} lookup at line 246 as defense in depth

Test plan

  • Verified the old regex fails on multi-line $@ strings while the new regex handles both single-line and multi-line correctly
  • Verified parsers() returns correct results without warnings after the fix

Generated by Kōan /fix


Quality Report

Changes: 1 file changed, 2 insertions(+), 2 deletions(-)

Code scan: clean

Tests: failed (297 Failed, 296 tests)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

When a failed `require` produces multi-line error messages in `$@`,
the modified `$p->[0]` (prefixed with "!") was not filtered by the
grep in parsers() because the regex `^(?:dmp|ios|!.*)$` fails when
`.*` cannot match across newlines to reach `$`.

Fix by simplifying the regex to `^(?:dmp|ios|!)` — only the prefix
matters. Also guard the `$can{$typ}` lookup with `// ""` as defense
in depth.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr
Copy link
Copy Markdown

toddr commented Mar 21, 2026

Please make a test that shows these failures.

All 7 tests pass. Here's a summary of what was added:

- **Created `t/12_parsers.t`** per reviewer request to add a test demonstrating the issue Tux#55 failures
  - Tests that `parsers()` returns results without warnings (catches the `$can{$typ}` undef warning fixed by the `// ""` guard)
  - Tests that no `!`-prefixed entries (failed modules) leak through the filter
  - Tests that helper modules (`dmp`, `ios`) are filtered out
  - Tests SquirrelCalc built-in presence as a sanity check
  - **Directly demonstrates the bug**: constructs a multiline `$@` string (as occurs on FreeBSD) and shows the old regex `m{^(?:dmp|ios|!.*)$}` fails to match it while the new regex `m{^(?:dmp|ios|!)}` correctly matches — this is the core regression test for issue Tux#55
@toddr-bot
Copy link
Copy Markdown
Author

Rebase: fix: uninitialized value warnings in parsers()

Branch koan.toddr.bot/fix-issue-55 rebased onto master and force-pushed.

Diff: 2 files changed, 55 insertions(+), 2 deletions(-)

Review feedback was analyzed and applied.

Changes

All 7 tests pass. Here's a summary of what was added:

  • Created t/12_parsers.t per reviewer request to add a test demonstrating the issue test 10_basics.t fail #55 failures
    • Tests that parsers() returns results without warnings (catches the $can{$typ} undef warning fixed by the // "" guard)
    • Tests that no !-prefixed entries (failed modules) leak through the filter
    • Tests that helper modules (dmp, ios) are filtered out
    • Tests SquirrelCalc built-in presence as a sanity check
    • Directly demonstrates the bug: constructs a multiline $@ string (as occurs on FreeBSD) and shows the old regex m{^(?:dmp|ios|!.*)$} fails to match it while the new regex m{^(?:dmp|ios|!)} correctly matches — this is the core regression test for issue test 10_basics.t fail #55

Actions

  • Rebased koan.toddr.bot/fix-issue-55 onto upstream/master
  • Applied review feedback
  • Force-pushed koan.toddr.bot/fix-issue-55 to origin
  • No CI runs found

Automated by Kōan

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.

test 10_basics.t fail

2 participants