CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=0, private, must-revalidate
content-type: text/html; charset=utf-8
etag: W/"c09b6a3358a09571465e5ab36d339cc2"
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
referrer-policy: strict-origin-when-cross-origin
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=3gcTwDHXDkiB%2BN34utWtfaaf5MGZHe2oTiISBIvo8WY%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1753258456"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=3gcTwDHXDkiB%2BN34utWtfaaf5MGZHe2oTiISBIvo8WY%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1753258456"
server: Heroku
set-cookie: _redmine_session=RVNtM05sVjZwMkVXb3VHdzA0dGw1aElnbVJkNDRBc3JMWW1FRGpWb1VpN3hrZVVNZWthRmtnaHVuODNVOWJ4bHBZSzhid2lsalpEbDRCaWV1cnVTYXYxVy9RTDA1UVpWWFVtWGQ4cWt6WjY5OFhRRzZ6SmZ4Z1ZPUTk2V21uejNER3IwNFpBLythRGNjMWVvbVdSbWcrMFpUWkExYitmaDUwMXFybVI3ZFArUWQza3g1bHBPSFpGZ3o0SGFENTMwLS1kOTFFWis0ZWp1R3Axb24xNUd0MFFRPT0%3D--e63f7e6856cd79ef285737554dfa7c64eb04a039; path=/; secure; httponly; samesite=lax
strict-transport-security: max-age=63072000; includeSubDomains
vary: Accept
via: 2.0 heroku-router
x-content-type-options: nosniff
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-request-id: 785094ef-81ac-03fd-26f5-edb12b72709f
x-runtime: 0.078985
x-xss-protection: 1; mode=block
content-length: 30521
date: Wed, 23 Jul 2025 08:14:16 GMT
Bug #21343: Namespace: singleton classes of root namespace leak between namespaces - Ruby - Ruby Issue Tracking System
Project
General
Profile
Tags
Custom queries
Actions
Bug #21343
openNamespace: singleton classes of root namespace leak between namespaces
Added by jhawthorn (John Hawthorn) 2 months ago. Updated about 2 months ago.
Description
Ruby classes all have singleton classes, those singleton classes have singleton classes, and so on with infinite nesting. Since we don't have infinite resources, we create these lazily.
Because of this, only a certain number of singleton classes exist in the root namespace. At a certain depth, mutable singleton classes end up shared between namespaces.
File.write("/tmp/ntest.rb", <<~'RUBY')
p String.singleton_class.singleton_class::Foo
String.singleton_class.singleton_class::Bar = 456
RUBY
String.singleton_class.singleton_class::Foo = 123
ns = Namespace.new
ns.require("/tmp/ntest.rb")
p String.singleton_class.singleton_class::Bar
RUBY_NAMESPACE=1 ruby nstest2.rb
ruby: warning: Namespace is experimental, and the behavior may change in the future!
See doc/namespace.md for known issues, etc.
123
456
Updated by byroot (Jean Boussier) 2 months ago
Seems adjacent to https://bugs.ruby-lang.org/issues/21330.
The klass
field like the flags
one isn't part of the classext_t
, so it's not effectively namespaced.
Actions
Like0
Like0Like0
Powered by Redmine © 2006-2025 Jean-Philippe Lang
Loading...