Preserve scalar slots assigned through localized glob aliases

未關閉
#1,939 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@fglock 已經在處理了。

開始於 2026年11月2日。

  • #1944 來自 @fglock —— 未關閉

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
java, perl
領域
backend

研究方向

Start with the reproducer in the issue: a localized whole-glob alias (local *SYM = *{...}) followed by *SYM = \$value. The issue points to RuntimeGlob.set and getGlobAliasGroup(this.globName) as the place where the scalar slot is written to the wrong glob. Run the snippet on both the JVM and interpreter backends. Done when it prints /tmp/example-state on both, and a permanent regression test covers scalar-slot assignment through a localized glob alias.

由索引模型根據 Issue 內容生成。

描述

area:runtime bug

Summary

PerlOnJava loses the destination scalar slot when a scalar reference is assigned through a localized whole-glob alias. Text::Template 1.61 uses this pattern to expose HASH values to template fragments; those variables become undefined in the template.

Minimal reproducer

use strict;
use warnings;
my $package = 'Probe';
my $name = 'state_dir';
my $value = '/tmp/example-state';
{
    no strict 'refs';
    local *SYM = *{"${package}::$name"};
    *SYM = \$value;
    print defined ${"${package}::$name"}
        ? ${"${package}::$name"} : '<undef>', "\n";
}

System Perl prints /tmp/example-state. PerlOnJava 5.44.1 prints an empty value (with an uninitialized-value warning) on both JVM and interpreter backends.

CPAN evidence

In CPAN random-tester run 20261030-095654-34969, App-Milter-Limit 0.54 fails t/limit-from.t and t/smoke.t on PerlOnJava. Both tests provide a temporary state_dir in their generated config, but Text::Template expands it to an empty string. App-Milter-Limit then applies its /var/run/milter-limit default and fails to create that directory due to permissions.

The archived system-Perl oracle passes the complete App-Milter-Limit suite: 6 test files and 21 tests. The PerlOnJava suite reports 2/6 test programs failed. The relevant environment was macOS 26.7.1 arm64, Java 24.0.2, PerlOnJava 5.44.1 (4dc1a6f4d), and system Perl 5.42.2.

Root cause

Text::Template's _install_hash uses local *SYM = *{"${dest}::$name"} and then assigns *SYM = \$val. PerlOnJava handles the reference assignment in RuntimeGlob.set by updating the scalar slot for getGlobAliasGroup(this.globName). In this localized alias case, the alias group associated with SYM does not carry the destination glob identity, so the destination package scalar remains undefined. The failure is reproducible without Text::Template using the snippet above.

Related, but distinct, reports: #1258 covers direct dynamic package-scalar aliasing; #1630 covered whole-glob aliases and localized IO replacements.

Acceptance criteria

  • The reproducer prints /tmp/example-state on system Perl and both PerlOnJava backends.
  • Add permanent project-owned regression coverage for scalar-slot assignment through a localized whole-glob alias.
  • App-Milter-Limit 0.54 passes all tests on both PerlOnJava backends.
主要語言
Perl
星號
65
分支
8
平均合併
6 小時 33 分鐘
30 天內合併 PR
178

環境準備

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