Fix HTML::Lint parser text and source-position mismatches

Open
#1,416 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java, perl

Research direction

Start with the shared PerlOnJava parser/scalar state handling used by HTML::Lint::Parser, then run the focused tests in t/10-test-html-lint.t, t/20-error-types-skip.t, t/40-where.t, and related files listed in the issue against both backends and system Perl. Done means both backend suites pass, structural diagnostics and source positions match system Perl, and a focused regression test covers the smallest token/position reproducer.

Written by the indexing model from the issue text.

Description

area:backend area:cpan-port area:parser area:runtime bug

HTML::Lint parser loses undefined text and source positions on both backends

Summary

The CPAN compatibility run for HTML::Lint v2.32 reports widespread failures in the pure-Perl HTML parser. The system-Perl suite passes, while both PerlOnJava execution backends reproduce the same failure pattern.

CPAN run: 20260916-111623-23683

Evidence
  • Tester-selected target: Test::HTML::Lint
  • System Perl: 352 tests pass across 44 test programs; only the optional POD-coverage test is skipped.
  • PerlOnJava JVM backend: 174 of 357 subtests fail across 35 of 44 test programs.
  • PerlOnJava interpreter backend: reproduces the same failure pattern in the focused/full-harness run.
  • No native dependency, external service, or platform prerequisite is involved.

Representative failures include:

  • HTML::Lint::Parser receives or exposes an empty/undefined text value incorrectly, producing repeated warnings such as Use of uninitialized value $text in pattern match.
  • Empty attribute values are reported as Unknown attribute "" on otherwise valid tags such as html, head, body, title, and p.
  • Expected structural errors such as elem-unopened, elem-unclosed, and doc-tag-required are replaced by attr-unknown errors.
  • Error locations collapse to (:1) or (0:1) instead of preserving the expected source line and column, for example (1:1).

The resulting failures affect t/10-test-html-lint.t, t/11-test-html-lint-overload.t, t/12-html_fragment_ok.t, t/20-error-types-skip.t, t/30-test-builder.t, t/40-where.t, t/50-multiple-files.t, and additional parser behavior tests.

Suspected cause

The failure appears to be in shared PerlOnJava parser/scalar state handling used by HTML::Lint::Parser: an absent token/text value is being represented as an empty string, and token position metadata is not preserved. This changes both the parser’s error classification and its reported source coordinates. Because both backends agree, the defect is likely in shared runtime/parser infrastructure rather than a backend-specific compiler path.

Suggested acceptance criteria
  1. HTML::Lint v2.32’s t/*.t suite passes on the JVM backend.
  2. The same suite passes on the interpreter backend.
  3. Undefined parser text does not become a spurious empty attribute value.
  4. Structural error codes and messages match system Perl.
  5. Source line and column information is preserved in parser diagnostics.
  6. Add a focused project-owned regression test for the smallest token/position reproducer, validated against system Perl.
Dominant language
Perl
Stars
64
Forks
6
Avg merge
5h 18m
Merged PRs (30d)
162

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.