Autovivify undefined hash reference in list assignment

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

維護者通常 1 天內回覆

已經有一個關聯 PR 被合併了。

  • #1960 來自 @fglock —— 已合併

評估

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

研究方向

Start by tracing shared list assignment for a hash dereference in the PerlOnJava runtime, then compare how both the JVM and interpreter backends handle an undefined scalar against an initialized hash reference. Add a focused regression for both cases; done means the reproducer passes on both backends, including the existing initialized-reference behavior.

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

描述

area:runtime bug

Summary

List assignment into a hash dereference does not autovivify an undefined scalar on either PerlOnJava backend. This breaks pure-Perl code that initializes a hash reference with ($self, %$type) = @_ and then reads it.

Reproducer

my ($self, $type);
($self, %$type) = ('Object::Hybrid', reftype => 'HASH', tieable => 0, mutable => 0, caller => 0);
die "missing hash assignment" unless $type->{reftype} eq 'HASH';

System Perl 5.42.2 passes. PerlOnJava at master b43a65250 leaves $type undefined and the key missing on both the JVM and interpreter backends. Initializing $type to {} before the assignment makes both PerlOnJava backends pass.

CPAN evidence

Object-Hybrid 0.07 passed all 909 tests under system Perl. CPAN run 20261103-123832-91742 failed at t/Object-Hybrid.t line 21 after its first assertion, with No 'reftype' parameter specified; the same failure reproduces on both PerlOnJava backends.

Suspected runtime path

The failure is in shared list assignment to a hash dereference. The assignment replaces the pending autovivification hash before the referenced scalar becomes a hash reference. A focused regression should cover the undefined-scalar case and continue to pass when the hash reference is already initialized.

主要語言
Perl
星號
65
分支
8
平均合併
5 小時 57 分鐘
30 天內合併 PR
177

環境準備

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