Skip to content

Fix jcpan -t DateTime regressions: XSLoader @ISA fallback and foreach null-stores#443

Merged
fglock merged 1 commit into
masterfrom
fix/jcpan-datetime-regressions
Apr 6, 2026
Merged

Fix jcpan -t DateTime regressions: XSLoader @ISA fallback and foreach null-stores#443
fglock merged 1 commit into
masterfrom
fix/jcpan-datetime-regressions

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 6, 2026

Summary

  • XSLoader @isa fallback too broad (regression from Template Toolkit support: 105/106 tests passing (99%) #441): When a module like Clone has @ISA = qw(Exporter) and XSLoader::load fails to find the Java XS class, the fallback code treated any non-empty @ISA as proof the module can work through inheritance. This prevented Clone::PP from loading, breaking the entire DateTime dependency chain. Fixed by adding a NON_FUNCTIONAL_ISA set (Exporter, DynaLoader, AutoLoader, XSLoader) and only succeeding on @ISA fallback when a functional parent is present.

  • emitScopeExitNullStores in foreach body (regression from WWW::Mechanize CPAN module support #440): Nulling JVM local variable slots at the end of each foreach loop iteration broke Test2 TODO mechanism. After a { local $TODO = "reason"; ... } block, done_testing() and subsequent test output were suppressed. Fixed by removing the body-scope null-stores from EmitForeach while keeping the outer-scope null-stores which run once after the loop completes.

  • TAP::Parser::Iterator::Process: Guard sysread return value against empty string and protect err handle close against missing refs.

Test plan

  • make passes all unit tests
  • ./jcpan -j 8 -t DateTime passes all 51 tests (3589/3589 subtests)
  • Test2 TODO mechanism works correctly: ./jperl -e 'use Test::More; ok(1, "test 1"); { local $TODO = "reason"; ok(1, "passing todo"); } ok(1, "test 3"); done_testing()' outputs all 3 tests and plan

Generated with Devin

@fglock fglock force-pushed the fix/jcpan-datetime-regressions branch from 31a1d65 to 9ad8b91 Compare April 6, 2026 17:33
…itCleanup

Three issues fixed:

1. XSLoader @isa fallback too broad (from #441): When a module like Clone
   has @isa=(Exporter) and XSLoader::load fails to find the Java XS class,
   the fallback code treated any non-empty @isa as proof the module can work
   through inheritance. This prevented Clone::PP from loading, breaking the
   entire DateTime dependency chain. Fix: add NON_FUNCTIONAL_ISA set
   (Exporter, DynaLoader, AutoLoader, XSLoader) and only succeed on @isa
   fallback when a functional parent is present.

2. scopeExitCleanup closing shared IO handles (from #440): The foreach body
   null-stores with closeIO=true called scopeExitCleanup on ALL scalars,
   including copies of shared filehandle references. This broke Test2 TODO
   mechanism because Test2::Formatter::TAP copies STDOUT handles into a
   loop variable, and scopeExitCleanup closed them prematurely. Fix: add
   ioOwner flag to RuntimeScalar, set only by IOOperator.open() when
   creating a new anonymous glob. scopeExitCleanup now only closes IO on
   scalars marked as IO owners. Copies via set() do not inherit the flag.

3. TAP::Parser::Iterator::Process warnings: Guard sysread return value
   against empty string, skip $fh == $err comparison when $err is not a
   real filehandle (empty string in PerlOnJava), and protect err handle
   close against missing refs.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock force-pushed the fix/jcpan-datetime-regressions branch from 9ad8b91 to 321ca79 Compare April 6, 2026 18:03
@fglock fglock merged commit 202cfe4 into master Apr 6, 2026
2 checks passed
@fglock fglock deleted the fix/jcpan-datetime-regressions branch April 6, 2026 18:19
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