ruby-changes:57268
From: usa <ko1@a...>
Date: Mon, 26 Aug 2019 23:19:13 +0900 (JST)
Subject: [ruby-changes:57268] usa: 662a3ca806 (ruby_2_5): merge revision(s) d118c84b0b9110462e479487ffaf175a75e5718e: [Backport #15199]
https://git.ruby-lang.org/ruby.git/commit/?id=662a3ca806 From 662a3ca8064d973a4f96184d2598741b6ee3c7ae Mon Sep 17 00:00:00 2001 From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Mon, 26 Aug 2019 14:18:58 +0000 Subject: merge revision(s) d118c84b0b9110462e479487ffaf175a75e5718e: [Backport #15199] Fix IO#scanf on pipes on Windows IO.seek on a pipe on Windows raises Errno::EINVAL instead of Errno::ESPIPE. Fixes Ruby Bug #15199 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e diff --git a/lib/scanf.rb b/lib/scanf.rb index 6bd7da4..27e815d 100644 --- a/lib/scanf.rb +++ b/lib/scanf.rb @@ -660,7 +660,7 @@ class IO https://github.com/ruby/ruby/blob/trunk/lib/scanf.rb#L660 begin seek(start_position + matched_so_far, IO::SEEK_SET) - rescue Errno::ESPIPE + rescue Errno::ESPIPE, Errno::EINVAL end soak_up_spaces if fstr.last_spec && fstr.space diff --git a/test/scanf/test_scanfio.rb b/test/scanf/test_scanfio.rb index cec8750..f7c4392 100644 --- a/test/scanf/test_scanfio.rb +++ b/test/scanf/test_scanfio.rb @@ -17,5 +17,12 @@ class TestScanfIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/scanf/test_scanfio.rb#L17 ensure fh.close end + + def test_pipe_scanf + r, w = IO.pipe + w.write('a') + w.close + assert_equal([], r.scanf('a')) + end end diff --git a/version.h b/version.h index d69e3af..142ea40 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1 #define RUBY_VERSION "2.5.6" #define RUBY_RELEASE_DATE "2019-08-26" -#define RUBY_PATCHLEVEL 173 +#define RUBY_PATCHLEVEL 174 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 8 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/