ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: naruse@airemix.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:74701] [Ruby trunk Bug#12011] honor Marshal.load post proc value for TYPE_LINK
Date: Tue, 29 Mar 2016 15:41:06 +0000	[thread overview]
Message-ID: <redmine.journal-57831.20160329154106.fdcafc5acc105aba@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-12011.20160120022515@ruby-lang.org

Issue #12011 has been updated by Yui NARUSE.

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.

----------------------------------------
Bug #12011: honor Marshal.load post proc value for TYPE_LINK
https://bugs.ruby-lang.org/issues/12011#change-57831

* Author: Yui NARUSE
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONE, 2.3: DONE
----------------------------------------
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/

      parent reply	other threads:[~2016-03-29 15:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-12011.20160120022515@ruby-lang.org>
2016-01-20  2:25 ` [ruby-core:72955] [Ruby trunk - Bug #12011] [Open] honor Marshal.load post proc value for TYPE_LINK naruse
2016-01-20  2:25 ` [ruby-core:72956] [Ruby trunk - Bug #12011] " naruse
2016-01-21  9:03 ` [ruby-core:73018] [Ruby trunk - Bug #12011] [Closed] " naruse
2016-02-25 10:26 ` [ruby-core:73981] [Ruby trunk Bug#12011] " usa
2016-03-09 13:59 ` [ruby-core:74243] " nagachika00
2016-03-29 15:41 ` naruse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-57831.20160329154106.fdcafc5acc105aba@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).