JVM caller(0) returns stale package in closure invoked by BEGIN
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start by tracing how JVM caller(0) resolves the active package for closures invoked in BEGIN blocks, using the ExtUtils::ParseXS::Node reproduction around line 5330. Add a focused regression that runs on system Perl, JVM, and interpreter backends, and verify the module loads without changing ExtUtils::ParseXS::Node::ISA. Then rerun the Bitcoin-Crypto 4.005 CPAN target and confirm setup reaches its test suite.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Loading ExtUtils::ParseXS::Node fails on the JVM backend because caller(0) inside a closure invoked from a BEGIN block reports a stale package. The closure then writes the new subclass's @ISA into ExtUtils::ParseXS::Node::ISA, corrupting the base class hierarchy. Interpreter and system Perl load the same module successfully.
This is a remaining caller-package case related to #1753 and its fix in #1754. That fix covers the Eval::Closure::Sandbox_N caller frame. This case occurs in ordinary package compilation in the large ExtUtils::ParseXS::Node source file.
Reproduction
The CPAN tester run 20261118-104825-43075 selected Bitcoin-Crypto 4.005. Its test suite never started in PerlOnJava. While resolving the Bitcoin::Secp256k1 configure dependency, loading ExtUtils::ParseXS::Node failed:
Recursive inheritance detected in hierarchy of class 'ExtUtils::ParseXS::Node'
BEGIN failed--compilation aborted at ExtUtils/ParseXS/Node.pm line 5330.
The relevant upstream code is structurally:
my $build_subclass;
BEGIN {
$build_subclass = sub {
my $class = caller(0);
no strict 'refs';
@{"${class}::ISA"} = $parent;
};
}
package ExtUtils::ParseXS::Node::INCLUDE_COMMAND;
BEGIN { $build_subclass->(-parent => 'include') }
With JVM DFS tracing enabled, the first declaration creates the valid chain:
INCLUDE @ISA = [Node::include]
Node::include @ISA = [Node::oneline]
Node::oneline @ISA = [Node]
Node @ISA = []
At the INCLUDE_COMMAND declaration, caller(0) resolves to ExtUtils::ParseXS::Node rather than ExtUtils::ParseXS::Node::INCLUDE_COMMAND. The assignment therefore changes Node::ISA to [Node::include]. The subsequent traversal reports the resulting cycle:
Node @ISA = [Node::include]
Node::include @ISA = [Node::oneline]
Node::oneline @ISA = [Node]
CYCLE DETECTED! Node already in visiting set
This identifies a stale package result from the JVM caller/source-location mapping for a closure in a BEGIN block. The visible inheritance-cycle diagnostic is secondary: the Perl source declares a valid subclass chain, and the package misidentification mutates the wrong @ISA.
Results
- PerlOnJava JVM backend: direct
-MExtUtils::ParseXS::Nodeload fails with exit 255. - PerlOnJava interpreter backend: the same module load succeeds.
- System Perl 5.42.2: the same module load succeeds.
- System Perl CPAN oracle for Bitcoin-Crypto 4.005: 77 files, 715 tests, PASS.
- PerlOnJava CPAN run: timed out during dependency setup, before Bitcoin-Crypto's tests began. The fallback Alien::Build setup subsequently stalled while downloading cmake; that stall is downstream of the incorrect caller package and corrupted
@ISA. - Reproduced in checkout
d800eff96c4ea7a6aaab5bb0c586c31e607f1220, Java 24.0.2, macOS, Perl 5.42.2.
Acceptance criteria
caller(0)inside the subclass-building closure invoked by aBEGINblock reports the package active at the call site on the JVM backend, including in a large source file with manyBEGINblocks.- Loading
ExtUtils::ParseXS::Nodesucceeds on the JVM backend and leavesExtUtils::ParseXS::Node::ISAunchanged. - Add a focused project-owned regression that passes on system Perl, JVM, and interpreter backends.
- Re-run the Bitcoin-Crypto 4.005 CPAN target and confirm dependency setup reaches the target test suite.
- Ngôn ngữ chính
- Perl
- Star
- 67
- Fork
- 8
- Merge trung bình
- 5 giờ 12 phút
- Pull request đã merge (30 ngày)
- 131
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fglock/PerlOnJava
-
area:cpan-port bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fglock/PerlOnJava#2153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port area:parser bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fglock/PerlOnJava#2137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:backend area:cpan-port area:runtime bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fglock/PerlOnJava#2071 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime documentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#1579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
fglock/PerlOnJava#2157 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fglock/PerlOnJava
Issue tương tự
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksĐang mởteam-cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
inverse-inc/packetfence#9728 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(char-create): show the real reason a character is refusedCó thể đã có người làm @baphomello đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày