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

ruby-changes:45766

From: naruse <ko1@a...>
Date: Sat, 11 Mar 2017 22:02:40 +0900 (JST)
Subject: [ruby-changes:45766] naruse:r57839 (ruby_2_4): merge revision(s) 57203:

naruse	2017-03-11 22:02:37 +0900 (Sat, 11 Mar 2017)

  New Revision: 57839

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

  Log:
    merge revision(s) 57203:
    
    io.c: ARGF fd leak
    
    * io.c (argf_next_argv): fix leak of fd after breaking in #each
      method.

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/io.c
    branches/ruby_2_4/test/ruby/test_argf.rb
    branches/ruby_2_4/version.h
Index: ruby_2_4/test/ruby/test_argf.rb
===================================================================
--- ruby_2_4/test/ruby/test_argf.rb	(revision 57838)
+++ ruby_2_4/test/ruby/test_argf.rb	(revision 57839)
@@ -137,7 +137,7 @@ class TestArgf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_argf.rb#L137
     INPUT
   end
 
-  def test_new_lineno
+  def test_new_lineno_each
     f = ARGF.class.new(@t1.path, @t2.path, @t3.path)
     result = []
     f.each {|line| result << [f.lineno, line]; break if result.size == 3}
@@ -146,10 +146,16 @@ class TestArgf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_argf.rb#L146
 
     f.rewind
     assert_equal(2, f.lineno)
+  ensure
+    f.close
+  end
 
+  def test_new_lineno_each_char
     f = ARGF.class.new(@t1.path, @t2.path, @t3.path)
     f.each_char.to_a
     assert_equal(0, f.lineno)
+  ensure
+    f.close
   end
 
   def test_inplace
Index: ruby_2_4/io.c
===================================================================
--- ruby_2_4/io.c	(revision 57838)
+++ ruby_2_4/io.c	(revision 57839)
@@ -8023,6 +8023,7 @@ argf_next_argv(VALUE argf) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/io.c#L8023
     }
 
     if (ARGF.next_p == 1) {
+	if (ARGF.init_p == 1) argf_close(argf);
       retry:
 	if (RARRAY_LEN(ARGF.argv) > 0) {
 	    VALUE filename = rb_ary_shift(ARGF.argv);
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 57838)
+++ ruby_2_4/version.h	(revision 57839)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.0"
 #define RUBY_RELEASE_DATE "2017-03-11"
-#define RUBY_PATCHLEVEL 7
+#define RUBY_PATCHLEVEL 8
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 3

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r57203


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

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