Actions
Bug #22282
open$VERBOSE and $DEBUG assignments have no effect under RUBY_BOX=1
Bug #22282:
$VERBOSE and $DEBUG assignments have no effect under RUBY_BOX=1
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-08-30T19:29:13Z master 3aa34522c1) [arm64-darwin27]
Description
Assigning to $VERBOSE or $DEBUG does nothing when RUBY_BOX=1 is set. The assignment lands in the box-local global variable table instead of reaching verbose_setter/debug_setter, so warnings are never silenced or enabled, and the alias variables keep reporting the unchanged interpreter flag.
$ ruby -e '$VERBOSE = nil; p [$VERBOSE, $-v, $-W]'
[nil, nil, 0]
$ RUBY_BOX=1 ruby -e '$VERBOSE = nil; p [$VERBOSE, $-v, $-W]'
[nil, true, 2]
$ ruby -e '$VERBOSE = nil; warn "printed"'
$ RUBY_BOX=1 ruby -e '$VERBOSE = nil; warn "printed"'
printed
$ RUBY_BOX=1 ruby -e '$DEBUG = true; p [$DEBUG, $-d]'
[true, false]
This silently breaks the old, $VERBOSE = $VERBOSE, nil; ...; $VERBOSE = old idiom that RubyGems, Bundler, Rails and many test suites rely on. ruby -W0 still works, because it sets the flag before the main box exists.
Reproduced on master (3aa34522c1) and on released 4.0.6. Found while running the RubyGems and Bundler suites under RUBY_BOX=1 (#22275).
Actions