From: "yahonda (Yasuo Honda) via ruby-core" Date: 2025-12-03T09:37:19+00:00 Subject: [ruby-core:124001] [Ruby Bug#21761] NameError: uninitialized constant only when RUBY_BOX=1 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 # because it is missing extensions Source locally installed gems is ignoring # because it is missing extensions Source locally installed gems is ignoring # because it is missing extensions Source locally installed gems is ignoring # 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 '
' /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 ' /home/yahonda/src/github.com/rails/rails/activerecord/Rakefile:232:in 'block in ' /home/yahonda/src/github.com/rails/rails/activerecord/Rakefile:231:in '' /home/yahonda/.local/share/mise/installs/ruby/trunk/bin/bundle:25:in '
' (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 '
' /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/