[前][次][番号順一覧][スレッド一覧]

ruby-changes:53512

From: nagachika <ko1@a...>
Date: Thu, 15 Nov 2018 00:21:56 +0900 (JST)
Subject: [ruby-changes:53512] nagachika:r65728 (ruby_2_5): merge revision(s) 62772: [Backport #14738]

nagachika	2018-11-15 00:21:50 +0900 (Thu, 15 Nov 2018)

  New Revision: 65728

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65728

  Log:
    merge revision(s) 62772: [Backport #14738]
    
    compile.c: fix load_from_binary
    
    * compile.c (ibf_load_iseq_each): realpath may be nil.  follow up
      r59709.  [fix https://github.com/Shopify/bootsnap/issues/132]
    
    From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>

  Modified directories:
    branches/ruby_2_5/
  Modified files:
    branches/ruby_2_5/compile.c
    branches/ruby_2_5/test/ruby/test_iseq.rb
    branches/ruby_2_5/version.h
Index: ruby_2_5/compile.c
===================================================================
--- ruby_2_5/compile.c	(revision 65727)
+++ ruby_2_5/compile.c	(revision 65728)
@@ -8635,7 +8635,15 @@ ibf_load_iseq_each(const struct ibf_load https://github.com/ruby/ruby/blob/trunk/ruby_2_5/compile.c#L8635
 		rb_raise(rb_eRuntimeError, "path object size mismatch");
 	    }
 	    path = rb_fstring(RARRAY_AREF(pathobj, 0));
-	    realpath = rb_fstring(RARRAY_AREF(pathobj, 1));
+	    realpath = RARRAY_AREF(pathobj, 1);
+	    if (!NIL_P(realpath)) {
+		if (!RB_TYPE_P(realpath, T_STRING)) {
+		    rb_raise(rb_eArgError, "unexpected realpath %"PRIxVALUE
+			     "(%x), path=%+"PRIsVALUE,
+			     realpath, TYPE(realpath), path);
+		}
+		realpath = rb_fstring(realpath);
+	    }
 	}
 	else {
 	    rb_raise(rb_eRuntimeError, "unexpected path object");
Index: ruby_2_5/test/ruby/test_iseq.rb
===================================================================
--- ruby_2_5/test/ruby/test_iseq.rb	(revision 65727)
+++ ruby_2_5/test/ruby/test_iseq.rb	(revision 65728)
@@ -391,6 +391,14 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_iseq.rb#L391
     }
   end
 
+  def test_to_binary_with_objects
+    code = "[]"+100.times.map{|i|"<</#{i}/"}.join
+    iseq = RubyVM::InstructionSequence.compile(code)
+    bin = assert_nothing_raised {iseq.to_binary}
+    iseq2 = RubyVM::InstructionSequence.load_from_binary(bin)
+    assert_equal(iseq2.to_a, iseq.to_a)
+  end
+
   def test_to_binary_tracepoint
     filename = "#{File.basename(__FILE__)}_#{__LINE__}"
     iseq = RubyVM::InstructionSequence.compile("x = 1\n y = 2", filename)
Index: ruby_2_5/version.h
===================================================================
--- ruby_2_5/version.h	(revision 65727)
+++ ruby_2_5/version.h	(revision 65728)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1
 #define RUBY_VERSION "2.5.4"
-#define RUBY_RELEASE_DATE "2018-11-07"
-#define RUBY_PATCHLEVEL 111
+#define RUBY_RELEASE_DATE "2018-11-15"
+#define RUBY_PATCHLEVEL 112
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 7
+#define RUBY_RELEASE_DAY 15
 
 #include "ruby/version.h"
 
Index: ruby_2_5
===================================================================
--- ruby_2_5	(revision 65727)
+++ ruby_2_5	(revision 65728)

Property changes on: ruby_2_5
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r62772

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]