Preserve scalar slots assigned through localized glob aliases

オープン
#1,939 コメント 0 件 リアクション 0 件 担当者 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分
マージ済み PR(30日)
178

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。