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

ruby-changes:34499

From: usa <ko1@a...>
Date: Fri, 27 Jun 2014 17:22:26 +0900 (JST)
Subject: [ruby-changes:34499] usa:r46580 (ruby_2_0_0): merge revision(s) 45979: [Backport #9847]

usa	2014-06-27 17:22:17 +0900 (Fri, 27 Jun 2014)

  New Revision: 46580

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

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

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/io.c
    branches/ruby_2_0_0/test/ruby/test_io.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 46579)
+++ ruby_2_0_0/ChangeLog	(revision 46580)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Jun 27 17:19:22 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (io_setstrbuf): always check if the buffer is modifiable.
+	  [ruby-core:62643] [Bug #9847]
+
 Fri Jun 27 17:15:36 2014  Tanaka Akira  <akr@f...>
 
 	* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#accept):
Index: ruby_2_0_0/io.c
===================================================================
--- ruby_2_0_0/io.c	(revision 46579)
+++ ruby_2_0_0/io.c	(revision 46580)
@@ -2253,8 +2253,8 @@ io_setstrbuf(VALUE *str, long len) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/io.c#L2253
 	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_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 46579)
+++ ruby_2_0_0/version.h	(revision 46580)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-06-27"
-#define RUBY_PATCHLEVEL 504
+#define RUBY_PATCHLEVEL 505
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_0_0/test/ruby/test_io.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_io.rb	(revision 46579)
+++ ruby_2_0_0/test/ruby/test_io.rb	(revision 46580)
@@ -2595,25 +2595,24 @@ End https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_io.rb#L2595
 
   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_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45979


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

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