Skip to content

Fix Role::Basic nested eval runtime context#686

Merged
fglock merged 2 commits intomasterfrom
fix/role-basic-eval-context-stack
May 8, 2026
Merged

Fix Role::Basic nested eval runtime context#686
fglock merged 2 commits intomasterfrom
fix/role-basic-eval-context-stack

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented May 8, 2026

Summary

  • Preserve nested eval STRING runtime contexts with a per-thread stack
  • Track and temporarily hide eval BEGIN-package aliases around nested require/do compilation
  • Add a Role::Basic-shaped regression test and update the module implementation notes

Verification

  • make
  • timeout 60 ./jperl src/test/resources/unit/eval_context_stack_reentrancy.t
  • timeout 600 ./jcpan -t Role::Basic

Generated with Codex

fglock and others added 2 commits May 8, 2026 15:56
Replace eval STRING runtime context storage with a per-thread stack so nested eval compilation cannot overwrite the outer context. Track temporary BEGIN-package aliases and hide them while require/do compilation runs, preventing reentrant role loads from reusing the outer lexical $role scalar.

Add a neutral regression test for the Role::Basic-shaped nested eval/use path and update the Role::Basic module notes with verification.

Verification:
- make
- timeout 60 ./jperl src/test/resources/unit/eval_context_stack_reentrancy.t
- timeout 600 ./jcpan -t Role::Basic

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: Codex <codex@openai.com>
Hide eval BEGIN aliases only while compiling required/do files, not while executing BEGIN wrappers. BEGIN blocks inside eval STRING need those aliases to mutate captured outer lexicals.

Add regression coverage for the BEGIN alias path exposed by op/grep.t.

Verification:
- make
- timeout 60 ./jperl src/test/resources/unit/eval_context_stack_reentrancy.t
- timeout 120 ../../jperl op/attrs.t
- timeout 120 ../../jperl op/grep.t
- timeout 120 ../../jperl op/magic.t
- timeout 180 ../../jperl op/eval.t
- timeout 600 ./jcpan -t Role::Basic

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: Codex <codex@openai.com>
@fglock fglock merged commit f7fa063 into master May 8, 2026
2 checks passed
@fglock fglock deleted the fix/role-basic-eval-context-stack branch May 8, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant