ruby-changes:40721
From: usa <ko1@a...>
Date: Mon, 30 Nov 2015 21:20:04 +0900 (JST)
Subject: [ruby-changes:40721] usa:r52800 (ruby_2_1): merge revision(s) 52745: [Backport #11738]
usa 2015-11-30 21:19:43 +0900 (Mon, 30 Nov 2015) New Revision: 52800 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52800 Log: merge revision(s) 52745: [Backport #11738] * io.c (argf_getpartial): should not resize str if the second argument is not given. [ruby-core:71668] [Bug #11738] 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_argf.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 52799) +++ ruby_2_1/ChangeLog (revision 52800) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Nov 30 21:18:24 2015 Shugo Maeda <shugo@r...> + + * io.c (argf_getpartial): should not resize str if the second + argument is not given. + [ruby-core:71668] [Bug #11738] + Mon Nov 30 21:17:08 2015 SHIBATA Hiroshi <hsbt@r...> * lib/net/http.rb: set hostname before call ossl_ssl_set_session. Index: ruby_2_1/io.c =================================================================== --- ruby_2_1/io.c (revision 52799) +++ ruby_2_1/io.c (revision 52800) @@ -10967,7 +10967,9 @@ argf_getpartial(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/ruby_2_1/io.c#L10967 } if (!next_argv()) { - rb_str_resize(str, 0); + if (!NIL_P(str)) { + rb_str_resize(str, 0); + } rb_eof_error(); } if (ARGF_GENERIC_INPUT_P()) { Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 52799) +++ ruby_2_1/version.h (revision 52800) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.8" #define RUBY_RELEASE_DATE "2015-11-30" -#define RUBY_PATCHLEVEL 425 +#define RUBY_PATCHLEVEL 426 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 11 Index: ruby_2_1/test/ruby/test_argf.rb =================================================================== --- ruby_2_1/test/ruby/test_argf.rb (revision 52799) +++ ruby_2_1/test/ruby/test_argf.rb (revision 52800) @@ -504,6 +504,17 @@ class TestArgf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_argf.rb#L504 end end + def test_readpartial_eof_twice + ruby('-W1', '-e', <<-SRC, @t1.path) do |f| + $stderr = $stdout + print ARGF.readpartial(256) + ARGF.readpartial(256) rescue p($!.class) + ARGF.readpartial(256) rescue p($!.class) + SRC + assert_equal("1\n2\nEOFError\nEOFError\n", f.read) + end + end + def test_getc ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| s = "" Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r52745 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/