Skip to content

fix(jcpan URI::Find): silence spurious eunicefix and Wide-character warnings#578

Merged
fglock merged 1 commit intomasterfrom
fix/uri-find-warnings
Apr 27, 2026
Merged

fix(jcpan URI::Find): silence spurious eunicefix and Wide-character warnings#578
fglock merged 1 commit intomasterfrom
fix/uri-find-warnings

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 27, 2026

Summary

jcpan -t URI::Find succeeds (619 tests pass) but emits two spurious warnings during build and test. This PR removes both.

1. Use of uninitialized value in join or string at Module/Build/Base.pm line 301

Module::Build's fix_shebang_line ends with:

$self->do_system($c->get('eunicefix'), $file) if $c->get('eunicefix') ne ':';

On real Perl $Config{eunicefix} is ':' (no-op), so the call is skipped. PerlOnJava's %Config was missing the key, so the guard evaluated undef ne ':' (true) and do_system(undef, $file) was invoked — log_verbose("@cmd\n") then interpolated undef.

Fix: add eunicefix => ':' to src/main/perl/lib/Config.pm.

(Side note: PerlOnJava attributed the warning to line 301 of Base.pm, which was misleading — the actual interpolation is in do_system/log_verbose. That's a pre-existing line-attribution issue, not addressed here.)

2. Wide character in print at Test2/Formatter/TAP.pm line 125 (×5)

t/Find.t prints non-ASCII URLs (Arabic, Russian, Chinese). Two combined causes:

  • open.pm was a no-op stub, so use open ':std', ':encoding(utf8)' didn't actually apply layers to STDIN/STDOUT/STDERR.
  • Even with explicit binmode, duplicateFileHandle (used by open $fh, '>&FILENO', which Test2::Util::clone_io invokes) replaced the original's LayeredIOHandle with a bare DupIOHandle, dropping the layers. PerlIO::get_layers(\*STDOUT) then reported an empty list, and clone_io produced a cloned handle without an :encoding/:utf8 layer, which then warned on every wide-character print.

Fixes:

  • open.pm: parse :std + layer specs and apply via binmode to STDIN/STDOUT/STDERR.
  • IOOperator.duplicateFileHandle: when the source is a LayeredIOHandle, dup the inner delegate and re-wrap each side in its own LayeredIOHandle carrying the same active layers.

Test plan

  • jcpan -t URI::Find is clean (All tests successful. Result: PASS, no warnings, 619 tests).
  • make (full unit-test suite) passes.

Generated with Devin

Two unrelated warnings appeared during `jcpan -t URI::Find`:

1) "Use of uninitialized value in join or string at Module/Build/Base.pm
   line 301" during `Build`. Module::Build's fix_shebang_line guards a
   call with `... ne ':'`, expecting %Config{eunicefix} to be ':' on
   non-EUNICE systems. PerlOnJava's Config.pm was missing the key, so
   the guard failed and `do_system(undef, $file)` ran, interpolating
   undef. Added `eunicefix => ':'` to Config.pm.

2) "Wide character in print at Test2/Formatter/TAP.pm line 125" while
   running tests that print non-ASCII URLs. Two combined causes:

   a) open.pm was a no-op stub, so `use open ':std', ':encoding(utf8)'`
      did not actually apply layers to STDIN/STDOUT/STDERR. Implemented
      a minimal `:std` + layer-spec import that calls binmode().

   b) duplicateFileHandle (used by `open $fh, '>&FILENO'`, which
      Test2::Util::clone_io invokes) replaced a LayeredIOHandle on the
      original handle with a bare DupIOHandle, dropping the layers.
      PerlIO::get_layers then returned empty, and clone_io produced a
      cloned handle without an :encoding/:utf8 layer. Fixed by
      detecting LayeredIOHandle, dup'ing its inner delegate, and
      re-wrapping both sides in fresh LayeredIOHandles that share the
      same active layers.

After the fixes `jcpan -t URI::Find` is clean (619 tests, PASS, no
warnings) and `make` passes.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock force-pushed the fix/uri-find-warnings branch from 5db0e7c to 1ae187b Compare April 27, 2026 19:36
@fglock fglock merged commit 4172b6e into master Apr 27, 2026
2 checks passed
@fglock fglock deleted the fix/uri-find-warnings branch April 27, 2026 20:04
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