From: "yahonda (Yasuo Honda) via ruby-core" Date: 2025-12-03T09:36:13+00:00 Subject: [ruby-core:124000] [Ruby Bug#21761] NameError: uninitialized constant only when RUBY_BOX=1 Issue #21761 has been reported by yahonda (Yasuo Honda). ---------------------------------------- Bug #21761: NameError: uninitialized constant only when RUBY_BOX=1 https://bugs.ruby-lang.org/issues/21761 * Author: yahonda (Yasuo Honda) * Status: Open * ruby -v: ruby 4.0.0dev (2025-12-03T07:14:56Z master 8c3909935e) +PRISM [x86_64-linux] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- This issue is originally found when I tested Ruby::Box against Rails main branch, I think I have created a repro. ### Steps to reproduce 1. Install Ruby master branch 2. Follow these steps below. ``` git clone https://github.com/yahonda/repro-ruby-box-uninitialized-constant cd repro-ruby-box-uninitialized-constant RUBY_BOX=1 rake ``` ### Expected behavior It should load the configuration as follows. ``` $ RUBY_BOX=0 rake Constants defined: ROOT = /tmp/test FIXTURES_ROOT = /tmp/test/fixtures Running test from Rakefile... --- Loading config.yml with ERB --- YAML content before ERB processing: default: path: <%= FIXTURES_ROOT %>/data name: test_fixture Processing ERB... YAML content after ERB processing: default: path: /tmp/test/fixtures/data name: test_fixture Parsed config: {"default" => {"path" => "/tmp/test/fixtures/data", "name" => "test_fixture"}} SUCCESS: Config loaded successfully $ ``` ### Actual behavior It raises the `NameError: uninitialized constant FIXTURES_ROOT`. ``` $ RUBY_BOX=1 rake /home/yahonda/.local/share/mise/installs/ruby/trunk/bin/ruby: warning: Ruby::Box is experimental, and the behavior may change in the future! See doc/language/box.md for known issues, etc. Constants defined: ROOT = /tmp/test FIXTURES_ROOT = /tmp/test/fixtures Running test from Rakefile... --- Loading config.yml with ERB --- YAML content before ERB processing: default: path: <%= FIXTURES_ROOT %>/data name: test_fixture Processing ERB... ERROR: NameError: uninitialized constant FIXTURES_ROOT (erb):2:in '
' /home/yahonda/.local/share/mise/installs/ruby/trunk/lib/ruby/4.0.0+0/erb.rb:1012:in 'Kernel#eval' /home/yahonda/.local/share/mise/installs/ruby/trunk/lib/ruby/4.0.0+0/erb.rb:1012:in 'ERB#result' /home/yahonda/src/github.com/yahonda/repro-ruby-box-uninitialized-constant/test_box.rb:19:in '' /home/yahonda/src/github.com/yahonda/repro-ruby-box-uninitialized-constant/Rakefile:8:in 'Kernel#require_relative' $ ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/