MakeMaker writes Perl v-string VERSION bytes into generated Makefile

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Start in src/main/perl/lib/ExtUtils/MakeMaker.pm and trace how WriteMakefile selects and passes VERSION into Makefile generation. Add a focused regression test for VERSION = v0.1.0 that checks generated version fields and recipes contain printable text without control bytes, then confirm the generated Makefile works with make. The issue notes that the full upstream suite cannot run under the available system Perl.

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

描述

area:cpan-port bug

Summary

File-Util-SecureDir v0.1.0 fails during the PerlOnJava MakeMaker build, before its test suite starts. Its Makefile.PL passes a dotted version string literal as the MakeMaker VERSION:

WriteMakefile(
    NAME    => 'File::Util::SecureDir',
    VERSION => v0.1.0,
    ...
);

PerlOnJava writes the literal's internal v-string bytes into the generated Makefile instead of its printable version representation. The resulting all recipe is malformed, and make exits with a shell unmatched-quote error.

Evidence

CPAN tester run 20261119-133823-51077, distribution LEMBARK/File-Util-SecureDir-v0.1.0.tar.gz:

  • Makefile.PL completes successfully.
  • The generated Makefile contains NUL/SOH/NUL bytes where the version should be (VERSION = <NUL><SOH><NUL>). PerlOnJava's MakeMaker diagnostic likewise prints the version as control bytes.
  • The all recipe interpolates that raw value into a quoted echo command.
  • /usr/bin/make fails before tests with /bin/sh: ... unexpected EOF while looking for matching \".

A minimal WriteMakefile(NAME => 'Probe::Version', VERSION => v0.1.0) probe reproduces the difference: system Perl's ExtUtils::MakeMaker emits the printable VERSION = v0.1.0, while PerlOnJava's generated Makefile has an empty/truncated version field and a recipe containing the raw control bytes.

Root cause

In src/main/perl/lib/ExtUtils/MakeMaker.pm, WriteMakefile selects $version directly from $args{VERSION} (or VERSION_FROM) and passes it into Makefile generation. The value is interpolated into Makefile variables and recipes without converting a Perl v-string to printable version text. A v-string such as v0.1.0 is internally represented as the bytes 00 01 00; embedding those bytes in a shell command causes the shell to see a truncated quoted command.

Proposed fix

Normalize the selected version to printable version text before using it in diagnostics, metadata, DISTVNAME, Makefile variables, and recipes. Use the core version module's parsed version string representation (while preserving ordinary decimal versions). Add a focused regression test that calls WriteMakefile with VERSION => v0.1.0, then verifies the generated Makefile contains a printable version and no embedded NUL/control bytes in version-derived fields or recipes. The generated Makefile should also be usable by make.

Standard Perl comparison and scope

The installed system Perl is 5.34.1, but this distribution declares use v5.36, so its full upstream configure/build/test suite could not be run under the available system Perl. The minimal system-Perl MakeMaker probe did emit the expected printable version. The archived PerlOnJava failure occurs during make all, before any upstream tests execute.

This is a pure-Perl CPAN distribution; there is no XS/native dependency or reverse-dependency count to report. Existing issue #2068 concerns Module::Install::Share staging and does not cover this v-string serialization bug.

主要语言
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 摘要。