Skip to content

[JVM/interpreter] local STDERR to IO::Scalar does not capture output #2034

Open

Description

@fglock

Summary

Localizing STDERR to an IO::Scalar handle does not capture output on either PerlOnJava backend.

Reproducer

use strict;
use warnings;
use IO::Scalar;
my $capture = IO::Scalar->new();
{
    local *STDERR = $capture;
    print STDERR "diagnostic\n";
}
die "diagnostic was not captured" unless "$capture" eq "diagnostic\n";

System Perl captures the diagnostic. PerlOnJava's JVM and interpreter backends leave the buffer empty.

CPAN evidence

  • Grep::Query 1.011, CPAN random run 20261111-090841-71684.
  • System Perl 5.42.2 passes all 490 tests.
  • PerlOnJava reports 468/490 passing. t/11-invalid.t fails 14/21 assertions because Grep::Query::Parser localizes STDERR to IO::Scalar while collecting Parse::RecDescent diagnostics; the buffer stays empty and the test sees UNKNOWN ERROR.
  • The reproducer passes on system Perl and fails on both PerlOnJava backends.

Root cause

The localized STDERR glob does not route writes to the replacement IO::Scalar handle. This prevents callers from retrieving output written through STDERR during the localized scope.

Related work

Issue #2015 covers Capture::Tiny's interpreter failure while duplicating STDOUT. This reproducer exercises direct STDERR localization to IO::Scalar and fails on both backends.

Acceptance criteria

  • local *STDERR = $capture routes print STDERR to the replacement handle on both PerlOnJava backends.
  • The reproducer and Grep::Query 1.011 t/11-invalid.t pass on system Perl and both PerlOnJava backends.

Activity

  1. added
    bug
    area:io
    area:backend
    on Nov 11, 2026
  2. fglock commented on Nov 12, 2026

    @fglock
    OwnerAuthor

    State: blocked
    Agent/session: Codex / io-archive-2034-2037-20261112
    Scope: #2034; direct localized STDERR writes from a blessed IO::Scalar object on JVM and interpreter, with project regression coverage.
    Work: feature/io-archive-capture-2034-2037, source 543f9df; no code changes or PR yet.
    Checkpoint: 2026-11-12; the focused test passes system Perl and fails on the exact parent JAR on both PerlOnJava backends with an empty buffer. Direct object print, local *STDERR = *$capture, and localization to a normal lexical filehandle pass on both backends. The failing boundary is direct typeglob assignment from the blessed overloaded handle object.
    Evidence: parent source 543f9dfef; nice -n 19 make passed in 17m01 (/tmp/io-archive-parent-make.log). System Perl regression result: /tmp/localized_stderr_io_scalar-perl.log; exact-parent JVM/interpreter failures: /tmp/issue2034-parent-jvm.log, /tmp/issue2034-parent-interpreter.log; parity probes: /tmp/issue2034-probe-perl.log, /tmp/issue2034-probe-jvm.log, /tmp/issue2034-probe-interpreter.log.
    Blocked by: #2043 active ownership migration overlaps the required RuntimeGlob/runtime typeglob assignment path (PR #1938 changes RuntimeGlob, RuntimeIO, and both backend assignment paths). No overlapping edits made.
    Next: reconcile with the #2043 owner after its active slice lands or a non-overlapping handoff is agreed, then implement and validate the focused fix.

  3. fglock commented on Nov 17, 2026

    @fglock
    OwnerAuthor

    Status update: PR #2076 merged as c832739e and closed #2058, #2055, and #2047. It did not include the localized STDERR to IO::Scalar fix. Issue #2034 remains blocked by the #2043 owner-slot work in open PR #1938, which still changes the overlapping RuntimeGlob/RuntimeIO typeglob assignment path. I made no #2034 code changes. The existing parent reproducer and backend evidence remain in the blocked claim above; this issue needs an explicit non-overlapping handoff or the #2043 work to land before implementation can resume.

  4. added
    blocked:ownership
    on Nov 19, 2026
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:backendarea:ioblocked:ownershipbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions