JVM regex loses package context for deferred user-defined Unicode properties

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
46/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java
领域
backend, testing

调研方向

Start by tracing RuntimeRegex and UnicodeResolver.activeUserPropertyPackage(), then compare runtime/dynamic regex construction and interpolated regex handling with the interpreter path. Read the existing user_property_package_provenance.t coverage and add a focused regression for Text::ANSI::Fold's deferred IsEOL resolution. Done means the regression passes on system Perl and both PerlOnJava backends, while explicitly qualified properties keep their behavior; confirm the upstream suite passes on the JVM and interpreter.

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

描述

area:backend area:regex bug

Summary

The JVM backend fails to resolve Text-ANSI-Fold's user-defined Unicode property IsEOL in its defining package. The property is defined as Text::ANSI::Fold::IsEOL, but regex execution reports an attempt to resolve main::IsEOL. The same distribution passes under system Perl and PerlOnJava's interpreter backend.

Reproducer

With Text-ANSI-Fold 2.3902 and its declared dependencies installed:

use Text::ANSI::Fold;
print Text::ANSI::Fold->fold("word", width => 10), "\n";

System Perl prints the folded text. On the PerlOnJava JVM backend, the call aborts with:

Unknown user-defined property name \p{main::IsEOL} at Text/ANSI/Fold.pm line 504.

The reported source line is in the folding path; IsEOL is defined in package Text::ANSI::Fold earlier in the module and returns the newline code-point ranges.

Evidence

  • Distribution: Text-ANSI-Fold 2.3902; CPAN run 20261119-133823-51077.
  • The archived JVM run passed t/00_compile.t, then failed across the suite with Unknown user-defined property name \\p{main::IsEOL}. t/17_progress.t also showed dependent assertion failures after property resolution failed.
  • System Perl 5.34.1 passed the complete upstream suite: 18 files, 576 tests.
  • PerlOnJava interpreter passed t/01_fold.t (48 tests). The JVM backend failed the same focused test with the diagnostic above.
  • PerlOnJava source revision used by the archived run: f00b834bab10d59c1dcf802784e05dd4c9726c22 (Perl 5.44.1); OpenJDK 24.0.2 on macOS arm64.

Root-cause direction

The diagnostic shows that the JVM path qualifies the property in main, although the property definition and the regex use belong to Text::ANSI::Fold. RuntimeRegex captures UnicodeResolver.activeUserPropertyPackage() in the compiled regex, and deferred Joni property resolution reinstates that captured package. The run therefore points to a package-provenance loss earlier in the JVM runtime-regex path: by the time the affected regex is compiled or its property context is captured, the package is already main. Trace runtime/dynamic regex construction and interpolated regex handling for this module against the interpreter path, and ensure deferred property resolution uses the regex's defining package.

Existing user_property_package_provenance.t coverage exercises package-local properties and embedding a compiled qr; it does not currently catch this CPAN runtime path.

Acceptance criteria

  • Add a focused project-owned regression that passes on system Perl, fails on the unfixed JVM backend with the package-context error, and passes on both PerlOnJava backends after the fix.
  • Preserve package context for IsEOL during the Text::ANSI::Fold call above, without changing how explicitly qualified properties resolve.
  • Re-run Text-ANSI-Fold 2.3902 on JVM and interpreter and confirm the upstream suite passes.
主要语言
Perl
星标
67
派生
8
平均合并
5 小时 12 分钟
30 天内合并 PR
131

环境准备

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