ruby-changes:40709
From: nagachika <ko1@a...>
Date: Sun, 29 Nov 2015 18:10:33 +0900 (JST)
Subject: [ruby-changes:40709] nagachika:r52788 (ruby_2_2): merge revision(s) 52745: [Backport #11738]
nagachika 2015-11-29 18:10:20 +0900 (Sun, 29 Nov 2015) New Revision: 52788 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52788 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_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/io.c branches/ruby_2_2/test/ruby/test_argf.rb branches/ruby_2_2/version.h Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 52787) +++ ruby_2_2/ChangeLog (revision 52788) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Sun Nov 29 18:02:44 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] + Sun Nov 29 17:48:39 2015 Nobuyoshi Nakada <nobu@r...> * vm_eval.c (local_var_list_add): skip internal local variable Index: ruby_2_2/io.c =================================================================== --- ruby_2_2/io.c (revision 52787) +++ ruby_2_2/io.c (revision 52788) @@ -11180,7 +11180,9 @@ argf_getpartial(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/ruby_2_2/io.c#L11180 } 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_2/version.h =================================================================== --- ruby_2_2/version.h (revision 52787) +++ ruby_2_2/version.h (revision 52788) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.4" #define RUBY_RELEASE_DATE "2015-11-29" -#define RUBY_PATCHLEVEL 213 +#define RUBY_PATCHLEVEL 214 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 11 Index: ruby_2_2/test/ruby/test_argf.rb =================================================================== --- ruby_2_2/test/ruby/test_argf.rb (revision 52787) +++ ruby_2_2/test/ruby/test_argf.rb (revision 52788) @@ -510,6 +510,17 @@ class TestArgf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_argf.rb#L510 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_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r52745 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/