Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Whole-glob aliases follow localized replacements instead of retaining the original GV

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
perl
领域
compilers

调研方向

Start with RuntimeGlob.set, RuntimeGlob.dynamicSaveState, and GlobalVariable.setGlobAlias to trace how whole-glob aliases and localized global IO bindings are represented. Add the project-owned regression for alias identity, nested localization, and scope restoration, then run the focused upstream test and the Smart-Comments-Log4perl 1.002 suite on both JVM and interpreter backends.

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

描述

area:io area:runtime bug

Summary

Whole-glob aliases incorrectly follow a dynamically localized replacement glob instead of retaining the original glob identity. This breaks code that saves a glob alias and later localizes the original name, including Smart::Comments::Log4perl's saved STDERR handle.

Minimal reproducer

package Capture;
use Tie::Handle;
sub TIEHANDLE { bless {}, shift }
sub TELL { 123 }
sub PRINT { }
package main;
*ORIGINAL = *STDERR;
close *STDERR;
my $buffer = q{};
open *STDERR, '>', \$buffer;
tie *CAPTURE, 'Capture';
{
    local *STDERR = *CAPTURE;
    print STDOUT "saved tell=", tell ORIGINAL, "\n";
}

System Perl prints saved tell=0. PerlOnJava prints saved tell=123 on both JVM and interpreter backends: ORIGINAL has incorrectly started resolving to the newly localized tied glob and dispatches to Capture::TELL.

CPAN evidence

  • Distribution: Smart-Comments-Log4perl 1.002
  • CPAN random tester run: 20261002-182937-4648
  • Upstream system Perl 5.42.2: all 10 test files pass (7 tests).
  • PerlOnJava 5.44.1, Java 24.0.2, macOS arm64: six test programs exit 255 before assertions. The JVM failure includes a StackOverflowError repeatedly entering Smart::Comments::Log4perl::IO::TELL, which delegates tell through its saved L4P_ORIGINAL_STDERR glob. The interpreter also fails the focused upstream test. The isolated glob/tie reproducer exhibits the wrong alias target on both backends.
  • The distribution and its dependencies are pure Perl; no XS or native prerequisite is involved.

Root cause

RuntimeGlob.set(RuntimeGlob) represents whole-glob assignment by recording a name alias through GlobalVariable.setGlobAlias. During local *STDERR, RuntimeGlob.dynamicSaveState installs a fresh RuntimeGlob in the global IO table for main::STDERR. Alias lookup remains name-based, so ORIGINAL resolves through main::STDERR to that new localized glob. Perl keeps the saved alias attached to the outer glob while the localized name refers to a temporary glob.

The alias relationship must preserve the original glob identity across dynamic localization and restore the named binding when the scope exits.

Acceptance criteria

  • Add a project-owned regression covering a whole-glob alias, localized replacement of its source name, and IO-slot access through the saved alias.
  • Match system Perl on both JVM and interpreter backends, including nested localization and scope restoration.
  • Verify the Smart-Comments-Log4perl 1.002 upstream suite passes on both backends.

Related issue

Related tied-filehandle work: #1338. That report covers a different tied-output dispatch failure; this report isolates the typeglob alias/localization defect.

主要语言
Perl
星标
64
派生
7
平均合并
5 小时 13 分钟
30 天内合并 PR
181

环境准备

  • 提供 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 摘要。