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

Method lookup still finds a subroutine after Symbol::Util delete_sub

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Start with the upstream t/50delete_sub.t test, especially test 23, and reproduce it under standard Perl to confirm the expected result. Trace the method lookup and symbol-table deletion paths, then add a project-owned regression covering delete_sub on both JVM and interpreter backends. Done means the focused regression and unchanged Symbol-Util 0.0203 test pass on both backends.

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

描述

area:runtime bug

Summary

After Symbol::Util::delete_sub removes a subroutine from the main package, PerlOnJava can still dispatch that subroutine as a class method. This breaks Perl's method lookup semantics: deleting main::FOO should make main->FOO unavailable, while unrelated calls through the remaining symbol table continue to work.

This is a pure-Perl compatibility failure, reproducible on both PerlOnJava execution backends. The unchanged upstream test passes under system Perl.

Reproduction

The failure is from Symbol-Util 0.0203, t/50delete_sub.t, test 23 (main->FOO is ok [2]). The relevant upstream sequence is:

use Symbol::Util 'delete_sub';

*FOO = sub { "code" };

# The method is initially available.
my $before = eval { main->FOO };

# Remove the CODE slot for main::FOO.
delete_sub("::FOO");

# Expected: method lookup fails, so the eval result is undefined.
my $after = eval { main->FOO };

Expected behavior under Perl: defined $after is false. On PerlOnJava, the upstream assertion ok(! defined eval { main->FOO }, 'main->FOO is ok [2]') fails, indicating that method dispatch still finds a defined result after deletion.

Evidence

  • CPAN random tester run: 20261002-095841-54171
  • Distribution: Symbol-Util 0.0203 (pure Perl)
  • Failing test: t/50delete_sub.t, assertion 23 of 24
  • Full PerlOnJava suite result: 306/307 assertions passed; 1/8 test programs failed
  • System Perl: all 307 assertions across 8 test programs passed in the archived oracle run; the focused t/50delete_sub.t also passes independently
  • PerlOnJava JVM backend: focused test fails at assertion 23
  • PerlOnJava interpreter backend: same focused assertion fails
  • Regression record: last known pass date 2026-09-12 at commit 141cdae65
  • Reproduced in current checkout at commit 0d3f46e4524573d58dd4ae91565f6de2d8b79435
  • Environment: macOS 26.6.2, Temurin OpenJDK 24.0.2, system Perl 5.42.2

The archived failing log also prints closedir() attempted on handle $GEN4 ... during CPAN configuration, but the target completed its tests and reported one ordinary assertion failure. The system-Perl oracle passed, and the focused failure reproduces directly on both backends, so that warning does not explain this result.

Expected behavior

Once delete_sub("::FOO") removes main::FOO's CODE slot, a subsequent main->FOO lookup must fail on both execution backends. The method lookup path must reflect the current package symbol table after this mutation.

Related issues

  • #1119 covers earlier Symbol::Util package-stash and typeglob-slot failures. Its report says subroutine deletion passed; this CPAN run records a later regression in that behavior.
  • #1523 covers method loss after a package stash is copied back. It is related to method dispatch after symbol-table mutation, but this report concerns stale successful lookup after delete_sub removes a method.

Suggested acceptance criteria

  • Add a focused project-owned regression test for method lookup after delete_sub removes a named CODE slot.
  • Validate the test with standard Perl before using it as a PerlOnJava regression test.
  • Confirm the test passes on both JVM and interpreter backends.
  • Confirm the unchanged Symbol-Util 0.0203 t/50delete_sub.t test passes.
主要语言
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 摘要。