Actions
Bug #22090
openEnabling Ruby::Box breaks Marshal.load
Bug #22090:
Enabling Ruby::Box breaks Marshal.load
ruby -v:
ruby 4.1.0dev (2026-05-31T10:35:05Z master 12c8599ffa) +PRISM [x86_64-linux]
Description
Updated by joker1007 (Tomohiro Hashidate) 3 months ago
- Subject changed from Enabling Ruby::Box breaks Marshal.load. to Enabling Ruby::Box breaks Marshal.load
Updated by mame (Yusuke Endoh) 3 months ago
- Status changed from Open to Assigned
- Assignee set to tagomoris (Satoshi Tagomori)
Updated by hsbt (Hiroshi SHIBATA) 9 days ago
The root cause is that Marshal.load is a builtin method written in Ruby (marshal.rb), so it is defined in the master box. The box resolution stops at that frame and looks up the dumped class names there, where user-defined classes are invisible. Marshal.dump is a plain C function and already operates on the caller's box, which is why only loading fails.
I proposed a fix in https://github.com/ruby/ruby/pull/18544: it adds Primitive.attr! :caller_box, which makes a builtin Ruby method operate on its caller's box like C functions do, and applies it to Marshal.load.
Updated by hsbt (Hiroshi SHIBATA) 9 days ago
- Related to Misc #22275: Ruby::Box support plan for RubyGems and Bundler added
Actions