PrereqScanner TestNeeds loses quoted module names and version literals
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
- 42/100
Hướng nghiên cứu
Bắt đầu với các trường hợp upstream bị lỗi trong t/test.t và trước tiên tái hiện chúng bằng system Perl, sau đó trên cả hai backend JVM và trình thông dịch. Theo dõi các literal được trích dẫn và các literal số qua đường dẫn giá trị của parser/compiler và lớp tương thích PPI/PPIx::Literal. Được xem là hoàn tất khi phạm vi kiểm thử hồi quy do dự án sở hữu duy trì nhiều tên module và phiên bản 5.020 một cách nhất quán trên cả hai backend.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Perl::PrereqScanner::Scanner::TestNeeds v0.001 regressed on PerlOnJava.
The scanner no longer preserves quoted module names or Perl version literals
when processing use Test::Needs statements.
The regression reproduces identically on both the JVM backend and the
interpreter backend.
CPAN evidence
- Distribution:
Perl-PrereqScanner-Scanner-TestNeedsv0.001 - Module:
Perl::PrereqScanner::Scanner::TestNeeds - CPAN run:
20260915-125610-17469 - Result: 2/3 assertions failed; 1/2 test programs failed
- Previous passing result: 2026-08-27, commit
4ebea751e - Standard Perl: complete upstream suite passes, 9 tests
- PerlOnJava: 2 assertions fail, followed by an invalid-version exception
- Native code: none in the target distribution or its relevant dependencies
The failing upstream tests are t/test.t assertions for one and multiple
module prerequisites. The failure occurs after the module's load test passes.
Reproduction
use Perl::PrereqScanner;
my $scanner = Perl::PrereqScanner->new({ scanners => ['TestNeeds'] });
my $prereqs = $scanner->scan_string(
q{use Test::Needs 'Local::Module1'}
);
use Data::Dumper;
print Dumper($prereqs->as_string_hash);
Expected under standard Perl:
{ 'Local::Module1' => 0 }
Observed on both PerlOnJava backends:
{ '' => 0 }
The version-literal case also differs:
$scanner->scan_string(q{use Test::Needs { perl => 5.020 }});
Expected:
{ perl => '5.020' }
Observed:
{ perl => '5.000' }
The upstream test then aborts with:
Can't convert '': Invalid version format (version required)
Backend scope
The exact upstream test command fails on both execution backends with the
same results:
- JVM backend:
Local::Module1andLocal::Module2are missing from the
prerequisite map; the test ends with invalid-version parsing. - Interpreter backend: the same missing module names and invalid-version
failure occur.
Likely ownership
The target module's implementation delegates source literal handling to
PPIx::Literal and prerequisite accumulation to Perl::PrereqScanner. The
failure is not in the upstream distribution: its complete suite passes under
standard Perl.
The PerlOnJava result suggests a shared literal/value representation defect:
- quoted string literals are converted to an empty string;
- version-like numeric literals lose their significant digits and become
5.000instead of5.020; - the resulting values are then passed into the scanner and version parser.
The regression should be investigated in the parser/compiler value path and
the PPI/PPIx::Literal compatibility layer, rather than by changing the CPAN
module or its tests.
Impact
This breaks static prerequisite scanning for Test::Needs, causing module
requirements to be silently recorded under the wrong name or omitted. It can
also misrepresent Perl version requirements, potentially allowing an
incorrect prerequisite set to pass validation or causing downstream tools to
abort with invalid-version errors.
Because Perl::PrereqScanner is used by CPAN tooling and distribution build
systems, the defect may affect more scanners and prerequisite declarations
than this small test distribution exposes.
Expected fix
Preserve the exact value and type of PPI/PPIx::Literal results when scanning
quoted strings and numeric/version literals. In particular:
use Test::Needs 'Local::Module1'must produce
Local::Module1 => 0.- Multiple quoted module names must all be retained.
perl => 5.020must retain the Perl version value5.020.- JVM and interpreter backends must agree.
Add permanent project-owned regression coverage, validated first with system
Perl, for quoted module names, multiple module names, and Perl version
literals.
Deduplication
GitHub searches were performed for PPIx::Literal, Perl::PrereqScanner,
Test::Needs, the empty-string prerequisite symptom, and the 5.020 version
conversion.
No existing issue directly covers this regression. Existing parser/runtime
issues found by the search concern unrelated behaviors, including DBI trace,
Unicode regex handling, typeglob localization, and hash-reference aliasing.
This report is therefore not a duplicate.
- Ngôn ngữ chính
- Perl
- Star
- 64
- Fork
- 6
- Merge trung bình
- 5 giờ 38 phút
- Pull request đã merge (30 ngày)
- 170
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 area:unicode bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
fglock/PerlOnJava#1341 ·
-
area:backend area:runtime bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
fglock/PerlOnJava#1511 ·
-
area:backend area:cpan-port bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
fglock/PerlOnJava#1508 · 1 bình luận ·
-
Port IPC::SysV (low priority) Đang mởarea:cpan-port area:platform enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
fglock/PerlOnJava#1507 ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
fglock/PerlOnJava#1506 ·
Tất cả issue của fglock/PerlOnJava
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
documentation Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
trizen/youtube-viewer#456 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
connectivity Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100