[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 '<main>' /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 '<top (required)>' /home/yahonda/src/github.com/yahonda/repro-ruby-box-uninitialized-constant/Rakefile:8:in 'Kernel#require_relative' $ ``` -- https://bugs.ruby-lang.org/
Issue #21761 has been updated by yahonda (Yasuo Honda). Here are original issue found. # Steps to reproduce ``` git clone https://github.com/rails/rails cd rails/activerecord rm ../Gemfile.lock bundle install RUBY_BOX=1 bundle exec rake test ``` # Actual behavior ``` $ RUBY_BOX=1 bundle exec rake test /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. Source locally installed gems is ignoring #<Bundler::StubSpecification name=prism version=1.6.0 platform=ruby> because it is missing extensions Source locally installed gems is ignoring #<Bundler::StubSpecification name=json version=2.16.0 platform=ruby> because it is missing extensions Source locally installed gems is ignoring #<Bundler::StubSpecification name=erb version=6.0.0 platform=ruby> because it is missing extensions Source locally installed gems is ignoring #<Bundler::StubSpecification name=date version=3.5.0 platform=ruby> because it is missing extensions rake aborted! NameError: uninitialized constant FIXTURES_ROOT (NameError) /home/yahonda/src/github.com/rails/rails/activerecord/test/config.yml:85:in '<main>' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/configuration_file.rb:57:in 'ActiveSupport::ConfigurationFile#render' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/configuration_file.rb:22:in 'ActiveSupport::ConfigurationFile#parse' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/configuration_file.rb:18:in 'ActiveSupport::ConfigurationFile.parse' /home/yahonda/src/github.com/rails/rails/activerecord/test/support/config.rb:23:in 'ARTest.read_config' /home/yahonda/src/github.com/rails/rails/activerecord/test/support/config.rb:10:in 'ARTest.config' /home/yahonda/src/github.com/rails/rails/activerecord/Rakefile:233:in 'block (2 levels) in <top (required)>' /home/yahonda/src/github.com/rails/rails/activerecord/Rakefile:232:in 'block in <top (required)>' /home/yahonda/src/github.com/rails/rails/activerecord/Rakefile:231:in '<top (required)>' /home/yahonda/.local/share/mise/installs/ruby/trunk/bin/bundle:25:in '<main>' (See full trace by running task with --trace) $ ``` ---------------------------------------- Bug #21761: NameError: uninitialized constant only when RUBY_BOX=1 https://bugs.ruby-lang.org/issues/21761#change-115428 * 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 '<main>' /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 '<top (required)>' /home/yahonda/src/github.com/yahonda/repro-ruby-box-uninitialized-constant/Rakefile:8:in 'Kernel#require_relative' $ ``` -- https://bugs.ruby-lang.org/
Issue #21761 has been updated by yahonda (Yasuo Honda). It does not reproduce without Rake. ```ruby $ RUBY_BOX=1 ruby test_box.rb 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 --- 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 $ ``` ---------------------------------------- Bug #21761: NameError: uninitialized constant only when RUBY_BOX=1 https://bugs.ruby-lang.org/issues/21761#change-115429 * 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 '<main>' /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 '<top (required)>' /home/yahonda/src/github.com/yahonda/repro-ruby-box-uninitialized-constant/Rakefile:8:in 'Kernel#require_relative' $ ``` -- https://bugs.ruby-lang.org/
Issue #21761 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to tagomoris (Satoshi Tagomori) ---------------------------------------- Bug #21761: NameError: uninitialized constant only when RUBY_BOX=1 https://bugs.ruby-lang.org/issues/21761#change-115526 * Author: yahonda (Yasuo Honda) * Status: Assigned * Assignee: tagomoris (Satoshi Tagomori) * 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 '<main>' /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 '<top (required)>' /home/yahonda/src/github.com/yahonda/repro-ruby-box-uninitialized-constant/Rakefile:8:in 'Kernel#require_relative' $ ``` -- https://bugs.ruby-lang.org/
participants (2)
-
mame (Yusuke Endoh) -
yahonda (Yasuo Honda)