Project

General

Profile

Bug #12011

honor Marshal.load post proc value for TYPE_LINK

Added by naruse (Yui NARUSE) almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:72955]

Description

Following test doesn't work.
A patch also attached.
Both of them are worked by nahi.

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

Associated revisions

Revision ca8b2d26
Added by usa (Usaku NAKAMURA) almost 4 years ago

merge revision(s) 53609: [Backport #12011]

    * marshal.c (r_object0): honor Marshal.load post proc
      value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
      https://github.com/ruby/ruby/pull/1204 fix GH-1204

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@53934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 53934
Added by usa (Usaku NAKAMURA) almost 4 years ago

merge revision(s) 53609: [Backport #12011]

* marshal.c (r_object0): honor Marshal.load post proc
  value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
  https://github.com/ruby/ruby/pull/1204 fix GH-1204

Revision 6aad84e0
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 53609: [Backport #12011]

    * marshal.c (r_object0): honor Marshal.load post proc
      value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
      https://github.com/ruby/ruby/pull/1204 fix GH-1204

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54068
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 53609: [Backport #12011]

* marshal.c (r_object0): honor Marshal.load post proc
  value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
  https://github.com/ruby/ruby/pull/1204 fix GH-1204

Revision b3418ceb
Added by naruse (Yui NARUSE) over 3 years ago

merge revision(s) 53609: [Backport #12011]

    * marshal.c (r_object0): honor Marshal.load post proc
      value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
      https://github.com/ruby/ruby/pull/1204 fix GH-1204

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54357
Added by naruse (Yui NARUSE) over 3 years ago

merge revision(s) 53609: [Backport #12011]

* marshal.c (r_object0): honor Marshal.load post proc
  value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
  https://github.com/ruby/ruby/pull/1204 fix GH-1204

History

Updated by naruse (Yui NARUSE) almost 4 years ago

  • Description updated (diff)

Updated by naruse (Yui NARUSE) almost 4 years ago

  • Status changed from Open to Closed

Updated by usa (Usaku NAKAMURA) almost 4 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.0.0: DONTNEED, 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED

ruby_2_1 r53934 merged revision(s) 53609.

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • 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.

Updated by naruse (Yui NARUSE) over 3 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONE, 2.3: REQUIRED to 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONE, 2.3: DONE

ruby_2_3 r54357 merged revision(s) 53609.

Also available in: Atom PDF