Skip to content

Preserve filehandle line counter assigned through localized $. #1965

Closed

Description

@fglock

Summary

arXiv::FileGuess 1.01 fails its focused t/arxiv/fileguess.t test on PerlOnJava because dynamically localizing $.' restores the previous filehandle line counter when the scope exits. System Perl preserves the counter value assigned to $.' in this case.

The test rewinds a file after reading its \\documentclass line, assigns local $. = 0 in a short block, then scans for \\pdfoutput=1 within the next five lines. On PerlOnJava, the filehandle counter returns to 10 after the block; rereading the fixture counts that marker as line 24, so detection incorrectly returns TYPE_LATEX2e instead of TYPE_PDFLATEX.

Evidence

  • Distribution: arXiv 1.01 (arXiv::FileGuess), pure Perl.
  • System Perl 5.42.2: the complete upstream suite passes; focused test passes.
  • PerlOnJava 5.44.1: upstream run fails 1 of 44 assertions; focused test reproduces on both JVM and interpreter backends.
  • Archived CPAN run: 20261104-113007-26634.
  • A focused line-counter reproduction confirms PerlOnJava restores the saved RuntimeIO.currentLineNumber from ScalarSpecialVariable.dynamicRestoreState() after the localized scope; system Perl leaves the assignment effective for the handle.

Please add project-owned regression coverage and make localized $.' match Perl's per-handle behavior.

Activity

  1. added
    bugSomething isn't working
    area:runtimeCore Perl runtime semantics
    area:ioFiles handles paths and networking
    on Nov 4, 2026
  2. fglock commented on Nov 4, 2026

    @fglock
    OwnerAuthor

    State: released
    Agent/session: codex-20261104-arxiv-1965
    Scope: #1965, project-owned coverage and fix for localized $. filehandle counter semantics.
    Work: PR #1967 merged to master as 9dde46a0ba9a5c8360b71bf2a88a05d31b8c5c7d.
    Checkpoint: 2026-11-04 14:42 UTC; fix merged and issue closed.
    Evidence: Ubuntu and Windows CI jobs passed on the merged PR; nice -n 19 make and nice -n 19 make check-links passed locally; regression test passes system Perl and both PerlOnJava backends; archived arXiv::FileGuess 1.01 test passes on both backends. Archived run 20261104-113007-26634.
    Blocked by: none.
    Next: none.

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:ioFiles handles paths and networkingarea:runtimeCore Perl runtime semanticsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions