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

ruby-changes:22429

From: naruse <ko1@a...>
Date: Wed, 8 Feb 2012 10:55:16 +0900 (JST)
Subject: [ruby-changes:22429] naruse:r34478 (ruby_1_9_3): merge revision(s) 34116:

naruse	2012-02-08 10:55:01 +0900 (Wed, 08 Feb 2012)

  New Revision: 34478

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

  Log:
    merge revision(s) 34116:
    
    * ext/readline/readline.c (readline_readline): check if outstream
      is closed to get rid of a bug of readline 6.  [ruby-dev:45043]
      [Bug #5803]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/ext/readline/readline.c
    branches/ruby_1_9_3/test/readline/test_readline.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 34477)
+++ ruby_1_9_3/ChangeLog	(revision 34478)
@@ -1,3 +1,9 @@
+Wed Feb  8 10:54:49 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/readline/readline.c (readline_readline): check if outstream
+	  is closed to get rid of a bug of readline 6.  [ruby-dev:45043]
+	  [Bug #5803]
+
 Wed Feb  8 10:52:51 2012  NARUSE, Yui  <naruse@r...>
 
 	* ext/readline/readline.c (Init_readline): like r18313, libedit's
Index: ruby_1_9_3/ext/readline/readline.c
===================================================================
--- ruby_1_9_3/ext/readline/readline.c	(revision 34477)
+++ ruby_1_9_3/ext/readline/readline.c	(revision 34478)
@@ -40,6 +40,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 static VALUE mReadline;
 
 #define EDIT_LINE_LIBRARY_VERSION "EditLine wrapper"
@@ -372,6 +376,13 @@
     }
 
     if (!isatty(fileno(rl_instream)) && errno == EBADF) rb_raise(rb_eIOError, "closed stdin");
+    if (rl_outstream) {
+	struct stat stbuf;
+	int fd = fileno(rl_outstream);
+	if (fd < 0 || fstat(fd, &stbuf) != 0) {
+	    rb_raise(rb_eIOError, "closed stdout");
+	}
+    }
 
 #ifdef _WIN32
     rl_prep_terminal(1);
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 34477)
+++ ruby_1_9_3/version.h	(revision 34478)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 61
+#define RUBY_PATCHLEVEL 62
 
 #define RUBY_RELEASE_DATE "2012-02-08"
 #define RUBY_RELEASE_YEAR 2012
Index: ruby_1_9_3/test/readline/test_readline.rb
===================================================================
--- ruby_1_9_3/test/readline/test_readline.rb	(revision 34477)
+++ ruby_1_9_3/test/readline/test_readline.rb	(revision 34478)
@@ -283,6 +283,16 @@
     end
   end
 
+  def test_closed_outstream
+    bug5803 = '[ruby-dev:45043]'
+    IO.pipe do |r, w|
+      Readline.input = r
+      Readline.output = w
+      (w << "##\t").close
+      assert_raise(IOError, bug5803) {Readline.readline}
+    end
+  end
+
   private
 
   def replace_stdio(stdin_path, stdout_path)

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

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