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

Parser executes trailing comment text on shebang lines

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

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Start with the t/testhelp shebang reproduction and compare its behavior across the JVM and interpreter backends. Run the focused command, then the relevant subprocess-response cases in t/gzip.t. Done means the complete shebang comment is discarded, @ARGV retains the three arguments, and the CGI-Compress-Gzip response tests pass without annotation or argument text.

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

描述

Summary

PerlOnJava does not fully discard a shebang/comment line when it contains a second # comment marker. Both backends execute text from the trailing Perl::Critic annotation as Perl code/output and consequently mishandle the script arguments that follow.

Reproduction

CGI-Compress-Gzip 1.03 contains t/testhelp, whose first line is:

#!perl -w ## no critic (RequireVersionVar)

Run the helper with its normal test arguments:

jperl -Iblib/arch -Iblib/lib t/testhelp -DHTTP_ACCEPT_ENCODING=gzip simple 'Hello World!'

Expected, as on standard Perl: a gzip response for Hello World!.

Actual on both the JVM and interpreter backends: the response is uncompressed, reports that the user agent does not accept gzip, and its body begins with:

nocritic(RequireVersionVar)-DHTTP_ACCEPT_ENCODING=gzipsimpleHello World!

The trailing comment contents and command-line arguments must not become program output. Perl should discard the complete shebang/comment line before compiling the script.

CPAN evidence

In CPAN random run 20260925-103132-20451, CGI-Compress-Gzip 1.03 failed 21 of 44 subtests in t/gzip.t on the JVM backend. The subprocess-response cases are directly caused by this parser defect. The same source passes all 44 tests under the standard-Perl oracle.

The focused helper reproduction also fails on the interpreter backend, so this is shared parser behavior rather than a JVM-only emission issue.

Acceptance criteria

  1. A script beginning with #!perl -w ## no critic (RequireVersionVar) does not emit any part of that line.
  2. Its @ARGV remains -DHTTP_ACCEPT_ENCODING=gzip, simple, and Hello World! when launched with those arguments.
  3. The focused reproducer passes on standard Perl, PerlOnJava JVM, and PerlOnJava interpreter backends.
  4. CGI-Compress-Gzip's subprocess-response tests no longer contain the annotation or argument text in their bodies.
主要语言
Perl
星标
64
派生
6
平均合并
5 小时
30 天内合并 PR
161

环境准备

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