Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

String eval does not inherit strict vars on either backend

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, perl
領域
backend, compilers

調査の方向性

Start with EvalStringHandler.java around lines 317-322 and 500-510, then inspect RuntimeCode.evalStringWithInterpreter and the shared eval-context capture. Run the minimal strict-vars reproducer and the Exporter::Easy 0.18 suite on both backends. Done means strict vars is inherited, no strict vars still disables it, declared variables remain usable, and permanent regression coverage passes.

索引モデルが issue の本文から書いたものです。

説明

bug

Summary

PerlOnJava does not inherit use strict's vars setting into string eval compilation. As a result, undeclared package variables inside an eval string execute successfully instead of producing Perl's compile-time strict-vars error.

This causes Exporter::Easy 0.18's negative tests to fail on both PerlOnJava backends.

CPAN failure

Archived CPAN run: 20260918-141920-96054

Distribution: Exporter-Easy-0.18

Target: Exporter::Easy

Results:

t/Easiest.t .. ok
t/Easy.t ..... 4 failed of 51
Files=2, Tests=72

The four failures are:

list vars can't use var @goodbye
list vars can't use var %goodbye
no vars can't use var @goodbye
no vars can't use var %goodbye

The test helper evaluates each expression with:

eval "package $pkg;$code"

Under system Perl, the undeclared @goodbye and %goodbye references correctly die under the surrounding use strict. Under PerlOnJava they execute successfully, so the negative assertions fail.

Minimal reproducer

use strict;

my $result = eval q{@goodbye};
die "strict vars was not enforced" unless $@;

Expected result: the eval fails with a diagnostic equivalent to:

Global symbol "@goodbye" requires explicit package name

Observed on both JVM and interpreter backends: the eval succeeds and returns an empty array value.

The CPAN test's package-qualified form also reproduces the issue:

use strict;
my $package = __PACKAGE__;
my $ok = eval "package $package;\\@goodbye";

Oracle comparison

The unchanged upstream suite passes completely under system Perl 5.42.2:

t/Easiest.t .. ok
t/Easy.t ..... ok
All tests successful.
Files=2, Tests=72

There are no XS/native components or external services involved.

Investigation and suspected ownership

The failure is in string-eval lexical-state propagation, not in Exporter::Easy's export logic.

The JVM eval path is implemented by EvalStringHandler. It creates a fresh ScopedSymbolTable and is intended to inherit strict options from the caller around EvalStringHandler.java lines 317-322 and 500-510. The eval parser then performs strict-vars validation against that new table.

The interpreter eval path is implemented by RuntimeCode.evalStringWithInterpreter; it obtains the saved eval context and parses the string separately. It exhibits the same missing strict-vars behavior, so the shared eval-context capture/propagation or eval compilation setup should be examined rather than only one backend's emitter.

The key semantic requirement is that eval STRING inherits the caller's lexical hints, including strict 'vars', while still allowing explicit no strict 'vars' to disable the check.

Related issue search

Issue #1302, “JVM backend rejects valid @$ glob dereference under strict vars,” is related to strict-vars handling but is not a duplicate. It covers a false positive for glob-dereference syntax; this issue covers missing strict-vars inheritance inside string eval and affects both backends.

Acceptance criteria

  • The minimal reproducer fails inside eval STRING under use strict on both JVM and interpreter backends.
  • no strict 'vars' continues to allow the same eval expression.
  • Lexically declared variables and explicitly declared package variables remain usable inside eval strings.
  • Exporter::Easy 0.18's full 72-test suite passes on both backends.
  • Add permanent project-owned regression coverage for strict-vars inheritance in string eval.
主要言語
Perl
スター
64
フォーク
7
平均マージ
5時間 8分
マージ済み PR(30日)
193

環境構築

はじめの一歩

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

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

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

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