Skip to content

JVM backend loses IO::Handle input_line_number #1933

Closed

Description

@fglock

Summary

The JVM backend cleared $. when a temporary borrowed alias of an anonymous filehandle left a subroutine scope, even though the caller still owned the live IO glob. A subsequent IO::Handle->input_line_number therefore returned undef. Pod::Eventual propagated that value as start_line => undef, causing Pod::Elemental's Int constraint to fail.

Reproduction

use IO::Handle;
my $text = "one\ntwo\n";
open my $fh, "<", \$text or die $!;
$fh->getline;
print defined($fh->input_line_number) ? $fh->input_line_number : "undef", "\n";

On the reported JVM run the result was undefined; interpreter and system Perl return 1.

Evidence

  • CPAN distribution: Pod::Elemental::Transformer::List 0.102001
  • Run: 20261030-095654-34969
  • Failing test: t/equiv-pods.t; original JVM run failed 1/3 test programs, with 0/4 subtests reached in the failing program.
  • System Perl oracle: all 3 files and 16 tests passed.
  • The focused regression fails on the unfixed origin/master baseline and passes on the fix under system Perl, JVM, and interpreter.
  • After the fix, all three distribution test files and all 16 tests pass under both PerlOnJava backends with the archived CPAN dependency load order.

The fix preserves last-read-handle context when an anonymous IO alias is borrowed and a live owner remains. Scope cleanup still clears the context when the actual owner leaves.

Activity

  1. added
    bugSomething isn't working
    area:runtimeCore Perl runtime semantics
    area:backendJVM interpreter or execution-backend behavior
    on Oct 30, 2026
  2. fglock commented on Oct 30, 2026

    @fglock
    OwnerAuthor

    State: released
    Agent/session: Codex issue-1933 CPAN classification follow-up
    Scope: #1933, fix JVM IO::Handle->input_line_number behavior and add permanent regression coverage.
    Work: feature/issue-1933-input-line-number, PR #1935 at bac75c7 (parent current master a5372ff)
    Checkpoint: 2026-10-30; ready-for-review PR is open with the confirmed borrowed-anonymous-IO cleanup fix.
    Evidence: unfixed-parent regression failed and passed with fix on system Perl/JVM/interpreter; current-master nice -n 19 make passed; full CPAN distribution passed 3 files/16 tests on both backends; check-links and offline changelog link check passed.
    Blocked by: none
    Next: await review and CI; no merge requested.

  3. added 2 commits that reference this issue on Oct 30, 2026
    bac75c7
    76478da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendJVM interpreter or execution-backend behaviorarea:runtimeCore Perl runtime semanticsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions