From: nagachika00@... Date: 2016-03-09T13:59:09+00:00 Subject: [ruby-core:74243] [Ruby trunk Bug#12011] honor Marshal.load post proc value for TYPE_LINK Issue #12011 has been updated by Tomoyuki Chikanaga. Backport changed from 2.0.0: DONTNEED, 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED to 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONE, 2.3: REQUIRED Backported into `ruby_2_2` branch at r54068. ---------------------------------------- Bug #12011: honor Marshal.load post proc value for TYPE_LINK https://bugs.ruby-lang.org/issues/12011#change-57378 * Author: Yui NARUSE * Status: Closed * Priority: Normal * Assignee: * ruby -v: * Backport: 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONE, 2.3: REQUIRED ---------------------------------------- Following test doesn't work. A patch also attached. Both of them are worked by nahi. ```diff diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 482637f..262e7f6 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -712,4 +712,10 @@ def test_no_internal_ids assert_predicate(status, :success?) assert_equal(expected, out) end + + def test_marshal_post_proc + str = 'x' # for link + obj = [str, str] + assert_equal(['X', 'X'], Marshal.load(Marshal.dump(obj), ->(v) { v == str ? v.upcase : v })) + end end diff --git a/marshal.c b/marshal.c index d67ce87..d64e5ff 100644 --- a/marshal.c +++ b/marshal.c @@ -1569,7 +1569,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) rb_raise(rb_eArgError, "dump format error (unlinked)"); } v = (VALUE)link; - r_post_proc(v, arg); + v = r_post_proc(v, arg); break; case TYPE_IVAR: ``` https://github.com/ruby/ruby/pull/1204 -- https://bugs.ruby-lang.org/ Unsubscribe: