summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-27 10:17:48 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-27 10:17:48 +0000
commit56c49c97805bfdbfe607a0456d2e1084c0fc318d (patch)
tree1f13d5b07e122968e5fcca54608d121c8f1a5d79
parentd604893f2065b3797218aa0607b3c21a13c82160 (diff)
Revert r49424. See [Bug #6232]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@49426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--ext/readline/readline.c38
-rw-r--r--test/readline/test_readline.rb12
-rw-r--r--version.h2
4 files changed, 9 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ea7da077a..4402d6fd42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,13 +4,6 @@ Tue Jan 27 17:05:43 2015 Seiei Higa <hanachin@gmail.com>
a refined method if the original method of the refined method is
not defined. [ruby-core:67523] [Bug #10731]
-Tue Jan 27 16:49:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/readline.c (readline_s_refresh_line): initialize
- before rl_refresh_line(), as some function make the internal
- state non-clean but rl_refresh_line() does not re-initialize it.
- [ruby-core:43957] [Bug #6232]
-
Tue Jan 27 16:41:33 2015 Seiei Higa <hanachin@gmail.com>
* vm_method.c (rb_export_method): bail out if the original method
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index e8c57f1b71..fe2ad7810d 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -288,34 +288,6 @@ readline_get(VALUE prompt)
return (VALUE)readline((char *)prompt);
}
-static void
-prepare_readline(void)
-{
- static int initialized = 0;
- if (!initialized) {
- rl_initialize();
- initialized = 1;
- }
-
- if (readline_instream) {
- rb_io_t *ifp;
- rb_io_check_initialized(ifp = RFILE(rb_io_taint_check(readline_instream))->fptr);
- if (ifp->fd < 0) {
- clear_rl_instream();
- rb_raise(rb_eIOError, "closed readline input");
- }
- }
-
- if (readline_outstream) {
- rb_io_t *ofp;
- rb_io_check_initialized(ofp = RFILE(rb_io_taint_check(readline_outstream))->fptr);
- if (ofp->fd < 0) {
- clear_rl_outstream();
- rb_raise(rb_eIOError, "closed readline output");
- }
- }
-}
-
/*
* call-seq:
* Readline.readline(prompt = "", add_hist = false) -> string or nil
@@ -420,7 +392,14 @@ readline_readline(int argc, VALUE *argv, VALUE self)
prompt = RSTRING_PTR(tmp);
}
- prepare_readline();
+ 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);
@@ -1476,7 +1455,6 @@ static VALUE
readline_s_refresh_line(VALUE self)
{
rb_secure(4);
- prepare_readline();
rl_refresh_line(0, 0);
return Qnil;
}
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index 93aa8da09b..84cfcf2ae3 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -439,18 +439,6 @@ class TestReadline < Test::Unit::TestCase
Readline::HISTORY.clear
end if !/EditLine/n.match(Readline::VERSION)
- def test_refresh_line
- bug6232 = '[ruby-core:43957] [Bug #6232] refresh_line after set_screen_size'
- with_temp_stdio do |stdin, stdout|
- replace_stdio(stdin.path, stdout.path) do
- assert_ruby_status(%w[-rreadline -], <<-'end;', bug6232)
- Readline.set_screen_size(40, 80)
- Readline.refresh_line
- end;
- end
- end
- end if Readline.respond_to?(:refresh_line)
-
private
def replace_stdio(stdin_path, stdout_path)
diff --git a/version.h b/version.h
index 8e9d1b8caa..d9acbe9b14 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2015-01-27"
-#define RUBY_PATCHLEVEL 621
+#define RUBY_PATCHLEVEL 622
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 1