diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-16 12:35:27 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-16 12:35:27 +0000 |
commit | 849e45dee80662c4192cbe9e6ce1161ac57c8edd (patch) | |
tree | 23e9cc760c78824cb486a0ecf875ea8c933258a5 | |
parent | 161fde4a43ba6f06abec13b28c82336f467eb6cf (diff) |
merges r30536 from trunk into ruby_1_9_2.
--
* io.c (argf_next_argv): go advance when the next file cannot be
read. [ruby-core:34446]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | test/ruby/test_argf.rb | 16 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 23 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Fri Jan 14 07:30:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (argf_next_argv): go advance when the next file cannot be + read. [ruby-core:34446] + Wed Jan 12 23:55:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> * io.c (rb_f_syscall): Add 64bit Linux support. Some syscall takes @@ -6778,7 +6778,6 @@ argf_next_argv(VALUE argf) } if (ARGF.next_p == 1) { - ARGF.next_p = 0; retry: if (RARRAY_LEN(ARGF.argv) > 0) { ARGF.filename = rb_ary_shift(ARGF.argv); @@ -6867,6 +6866,7 @@ argf_next_argv(VALUE argf) fptr->encs = ARGF.encs; clear_codeconv(fptr); } + ARGF.next_p = 0; } else { ARGF.next_p = 1; diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index ffd5096789..678b811580 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -694,4 +694,20 @@ class TestArgf < Test::Unit::TestCase assert_equal([@t1.path, @t2.path, @t3.path].inspect, f.gets.chomp) end end + + def test_unreadable + bug4274 = '[ruby-core:34446]' + paths = (1..2).map do + t = Tempfile.new("bug4274-") + path = t.path + t.close! + path + end + argf = ARGF.class.new(*paths) + paths.each do |path| + e = assert_raise(Errno::ENOENT) {argf.gets} + assert_match(/- #{Regexp.quote(path)}\z/, e.message) + end + assert_nil(argf.gets, bug4274) + end end @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 154 +#define RUBY_PATCHLEVEL 155 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |