MakeMaker writes Perl v-string VERSION bytes into generated Makefile

オープン
#2,126 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
131

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。