Project

General

Profile

Bug #15199

scanf.rb broken with io from IO.pipe (MinGW or Windows?)

Added by MSP-Greg (Greg L) 7 months ago. Updated 6 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:89271]

Description

scanf.rb seems to be broken when using an io from a pipe.

The following code is used in IO#scanf:

link: https://github.com/ruby/ruby/blob/d4b0efc010a45e904ecdad2dd74374b5c74e61e3/lib/scanf.rb#L661-L664

begin
  seek(start_position + matched_so_far, IO::SEEK_SET)
rescue Errno::ESPIPE
end

if the rescue statement is replaced with:

rescue Errno::ESPIPE, Errno::EINVAL

It seems to work. I assume at some point, a 'pipe' io raised an Errno::ESPIPE error when called with #seek, but trunk & 2.3 respond with Errno::EINVAL...

History

#1

Updated by MSP-Greg (Greg L) 7 months ago

  • Subject changed from scanf.rb broken with io from IO.pipe to scanf.rb broken with io from IO.pipe (MinGW or Windows?)
#2

Updated by nagachika (Tomoyuki Chikanaga) 6 months ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED

Also available in: Atom PDF