[ruby-core:121955] [Ruby Bug#21320] Namespaces leak with constant lookup
Issue #21320 has been reported by fxn (Xavier Noria). ---------------------------------------- Bug #21320: Namespaces leak with constant lookup https://bugs.ruby-lang.org/issues/21320 * Author: fxn (Xavier Noria) * Status: Open * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The following program ```ruby X = :top class C X = :super end class D < C p X end ``` prints `:super` normally, and `:top` if running under a namespace. -- https://bugs.ruby-lang.org/
Issue #21320 has been updated by fxn (Xavier Noria). This is probably a consequence of https://bugs.ruby-lang.org/issues/21318. ---------------------------------------- Bug #21320: Namespaces leak with constant lookup https://bugs.ruby-lang.org/issues/21320#change-113085 * Author: fxn (Xavier Noria) * Status: Open * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The following program ```ruby X = :top class C X = :super end class D < C p X end ``` prints `:super` normally, and `:top` if running under a namespace. -- https://bugs.ruby-lang.org/
Issue #21320 has been updated by Eregon (Benoit Daloze). Full repro: ``` # Copy the description program to program.rb, e.g. $ xsel -b > program.rb $ RUBY_NAMESPACE=1 ruby -ve 'puts "in main"; require "./program"; puts "in namespace"; Namespace.new.require "./program"' ruby 3.5.0dev (2025-05-10T07:50:29Z namespace-on-read-.. bd4f57f96b) +PRISM [x86_64-linux] ruby: warning: Namespace is experimental, and the behavior may change in the future! See doc/namespace.md for know issues, etc. in main :super in namespace :top ``` ---------------------------------------- Bug #21320: Namespaces leak with constant lookup https://bugs.ruby-lang.org/issues/21320#change-113100 * Author: fxn (Xavier Noria) * Status: Open * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The following program ```ruby X = :top class C X = :super end class D < C p X end ``` prints `:super` normally, and `:top` if running under a namespace. -- https://bugs.ruby-lang.org/
Issue #21320 has been updated by tagomoris (Satoshi Tagomori). Assignee set to tagomoris (Satoshi Tagomori) ---------------------------------------- Bug #21320: Namespaces leak with constant lookup https://bugs.ruby-lang.org/issues/21320#change-115534 * Author: fxn (Xavier Noria) * Status: Open * Assignee: tagomoris (Satoshi Tagomori) * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The following program ```ruby X = :top class C X = :super end class D < C p X end ``` prints `:super` normally, and `:top` if running under a namespace. -- https://bugs.ruby-lang.org/
Issue #21320 has been updated by tagomoris (Satoshi Tagomori). Status changed from Open to Closed This issue is fixed now. ``` MBA:build s-tagomori$ cat b.rb X = :top class C X = :super end class D < C p X end MBA:build s-tagomori$ RUBY_BOX=1 ./exe/ruby -ve 'puts "in main"; require "./b"; puts "in box"; Ruby::Box.new.require "./b"' ruby 4.0.0dev (2025-12-09T12:29:36Z box-news-documents.. c998717de8) +PRISM [arm64-darwin24] ./exe/ruby: warning: Ruby::Box is experimental, and the behavior may change in the future! See doc/language/box.md for known issues, etc. in main :super in box :super MBA:build s-tagomori$ ./exe/ruby -v ruby 4.0.0dev (2025-12-09T12:29:36Z box-news-documents.. c998717de8) +PRISM [arm64-darwin24] MBA:build s-tagomori$ ``` ---------------------------------------- Bug #21320: Namespaces leak with constant lookup https://bugs.ruby-lang.org/issues/21320#change-115544 * Author: fxn (Xavier Noria) * Status: Closed * Assignee: tagomoris (Satoshi Tagomori) * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The following program ```ruby X = :top class C X = :super end class D < C p X end ``` prints `:super` normally, and `:top` if running under a namespace. -- https://bugs.ruby-lang.org/
participants (3)
-
Eregon (Benoit Daloze) -
fxn (Xavier Noria) -
tagomoris (Satoshi Tagomori)