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

ruby-changes:41971

From: nagachika <ko1@a...>
Date: Wed, 9 Mar 2016 05:27:07 +0900 (JST)
Subject: [ruby-changes:41971] nagachika:r54045 (ruby_2_2): merge revision(s) 51016, 53329: [Backport #11885]

nagachika	2016-03-09 05:27:01 +0900 (Wed, 09 Mar 2016)

  New Revision: 54045

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

  Log:
    merge revision(s) 51016,53329: [Backport #11885]
    
    * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal):
      do not process kwargs in blocking mode
    
    * test/openssl/test_ssl.rb: test sysread
    
    * io.c (io_getpartial): remove unused kwarg from template
    
    * test/ruby/test_io.rb (test_readpartial_bad_args): new
      [Bug #11885]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/ext/openssl/ossl_ssl.c
    branches/ruby_2_2/io.c
    branches/ruby_2_2/test/openssl/test_ssl.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 54044)
+++ ruby_2_2/version.h	(revision 54045)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.5"
 #define RUBY_RELEASE_DATE "2016-03-09"
-#define RUBY_PATCHLEVEL 249
+#define RUBY_PATCHLEVEL 250
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_2/test/openssl/test_ssl.rb
===================================================================
--- ruby_2_2/test/openssl/test_ssl.rb	(revision 54044)
+++ ruby_2_2/test/openssl/test_ssl.rb	(revision 54045)
@@ -60,6 +60,20 @@ class OpenSSL::TestSSL < OpenSSL::SSLTes https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/openssl/test_ssl.rb#L60
     }
   end
 
+  def test_ssl_sysread_blocking_error
+    start_server(OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
+      server_connect(port) { |ssl|
+        ssl.write("abc\n")
+        assert_raise(TypeError) { ssl.sysread(4, exception: false) }
+        buf = ''
+        assert_raise(ArgumentError) { ssl.sysread(4, buf, exception: false) }
+        assert_equal '', buf
+        assert_equal buf.object_id, ssl.sysread(4, buf).object_id
+        assert_equal "abc\n", buf
+      }
+    }
+  end
+
   def test_connect_and_close
     start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
       sock = TCPSocket.new("127.0.0.1", port)
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 54044)
+++ ruby_2_2/ChangeLog	(revision 54045)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Wed Mar  9 05:14:20 2016  Eric Wong  <e@8...>
+
+	* io.c (io_getpartial): remove unused kwarg from template
+	* test/ruby/test_io.rb (test_readpartial_bad_args): new
+	  [Bug #11885]
+
+Wed Mar  9 05:14:20 2016  Eric Wong  <e@8...>
+
+	* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal):
+	  do not process kwargs in blocking mode
+	* test/openssl/test_ssl.rb: test sysread
+
 Wed Mar  9 04:21:02 2016  NAKAMURA Usaku  <usa@r...>
 
 	* process.c (rb_execarg_parent_start1): need to convert the encoding to
Index: ruby_2_2/ext/openssl/ossl_ssl.c
===================================================================
--- ruby_2_2/ext/openssl/ossl_ssl.c	(revision 54044)
+++ ruby_2_2/ext/openssl/ossl_ssl.c	(revision 54045)
@@ -1423,7 +1423,11 @@ ossl_ssl_read_internal(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/openssl/ossl_ssl.c#L1423
     rb_io_t *fptr;
     VALUE opts = Qnil;
 
-    rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+    if (nonblock) {
+	rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+    } else {
+	rb_scan_args(argc, argv, "11", &len, &str);
+    }
 
     if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
 	no_exception = 1;
Index: ruby_2_2/io.c
===================================================================
--- ruby_2_2/io.c	(revision 54044)
+++ ruby_2_2/io.c	(revision 54045)
@@ -2675,8 +2675,10 @@ io_read_nonblock(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/io.c#L2675
 
     rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
 
-    if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts))
+    if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts)) {
 	no_exception = 1;
+	argc--;
+    }
 
     ret = io_getpartial(argc, argv, io, 1, no_exception);
 

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51016


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

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