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

未关闭
#2,034 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
perl
领域
backend

调研方向

Start by tracing how localized typeglob assignments route writes to standard handles in both the JVM and interpreter backends; the issue names no source files or tests in the repository. Reproduce the supplied IO::Scalar case on each backend, then check whether Grep::Query 1.011's t/11-invalid.t passes. Done means both backends capture the diagnostic and pass those acceptance checks.

由索引模型根据 Issue 内容生成。

描述

area:backend area:io bug

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.
主要语言
Perl
星标
67
派生
8
平均合并
5 小时 12 分钟
30 天内合并 PR
131

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。