[ruby-core:93152] [Ruby trunk Bug#15199] scanf.rb broken with io from IO.pipe (MinGW or Windows?)

From: merch-redmine@...
Date: 2019-06-15 00:56:17 UTC
List: ruby-core #93152
Issue #15199 has been updated by jeremyevans0 (Jeremy Evans).


I've tested on Windows and confirmed this is a bug.

I added a pull request upstream to fix this: https://github.com/ruby/scanf/pull/4

If nobody has objections, I'll merge this in about a week.

----------------------------------------
Bug #15199: scanf.rb broken with io from IO.pipe (MinGW or Windows?)
https://bugs.ruby-lang.org/issues/15199#change-78596

* Author: MSP-Greg (Greg L)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED
----------------------------------------
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

```ruby
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...



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next