summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-16 12:35:27 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-16 12:35:27 +0000
commit849e45dee80662c4192cbe9e6ce1161ac57c8edd (patch)
tree23e9cc760c78824cb486a0ecf875ea8c933258a5
parent161fde4a43ba6f06abec13b28c82336f467eb6cf (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--ChangeLog5
-rw-r--r--io.c2
-rw-r--r--test/ruby/test_argf.rb16
-rw-r--r--version.h2
4 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c9bed54898..a51be7ab17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/io.c b/io.c
index 099ad2c756..bd5494696b 100644
--- a/io.c
+++ b/io.c
@@ -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
diff --git a/version.h b/version.h
index 6a15475518..5a62b244d0 100644
--- a/version.h
+++ b/version.h
@@ -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