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

ruby-changes:34533

From: nagachika <ko1@a...>
Date: Mon, 30 Jun 2014 02:34:59 +0900 (JST)
Subject: [ruby-changes:34533] nagachika:r46614 (ruby_2_1): merge revision(s) r45979: [Backport #9847]

nagachika	2014-06-30 02:34:43 +0900 (Mon, 30 Jun 2014)

  New Revision: 46614

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

  Log:
    merge revision(s) r45979: [Backport #9847]
    
    * io.c (io_setstrbuf): always check if the buffer is modifiable.
      [ruby-core:62643] [Bug #9847]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/io.c
    branches/ruby_2_1/test/ruby/test_io.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 46613)
+++ ruby_2_1/ChangeLog	(revision 46614)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Jun 30 02:28:10 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (io_setstrbuf): always check if the buffer is modifiable.
+	  [ruby-core:62643] [Bug #9847]
+
 Mon Jun 30 02:25:00 2014  Tanaka Akira  <akr@f...>
 
 	* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#accept):
Index: ruby_2_1/io.c
===================================================================
--- ruby_2_1/io.c	(revision 46613)
+++ ruby_2_1/io.c	(revision 46614)
@@ -2290,8 +2290,8 @@ io_setstrbuf(VALUE *str, long len) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/io.c#L2290
 	VALUE s = StringValue(*str);
 	long clen = RSTRING_LEN(s);
 	if (clen >= len) {
+	    rb_str_modify(s);
 	    if (clen != len) {
-		rb_str_modify(s);
 		rb_str_set_len(s, len);
 	    }
 	    return;
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 46613)
+++ ruby_2_1/version.h	(revision 46614)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
 #define RUBY_RELEASE_DATE "2014-06-30"
-#define RUBY_PATCHLEVEL 151
+#define RUBY_PATCHLEVEL 152
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_1/test/ruby/test_io.rb
===================================================================
--- ruby_2_1/test/ruby/test_io.rb	(revision 46613)
+++ ruby_2_1/test/ruby/test_io.rb	(revision 46614)
@@ -2790,25 +2790,24 @@ End https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_io.rb#L2790
 
   def assert_buffer_not_raise_shared_string_error
     bug6764 = '[ruby-core:46586]'
+    bug9847 = '[ruby-core:62643] [Bug #9847]'
     size = 28
     data = [*"a".."z", *"A".."Z"].shuffle.join("")
     t = Tempfile.new("test_io")
     t.write(data)
     t.close
-    w = Tempfile.new("test_io")
+    w = []
     assert_nothing_raised(RuntimeError, bug6764) do
+      buf = ''
       File.open(t.path, "r") do |r|
-        buf = ''
         while yield(r, size, buf)
-          w << buf
+          w << buf.dup
         end
       end
     end
-    w.close
-    assert_equal(data, w.open.read, bug6764)
+    assert_equal(data, w.join(""), bug9847)
   ensure
     t.close!
-    w.close!
   end
 
   def test_read_buffer_not_raise_shared_string_error

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45979


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

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