Issue #11738 has been updated by Shugo Maeda.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Eric Wong wrote:
> 1.9.3, 2.0.0, and 2.1 branches segfault for me, even.
>  Current bug is 2.2+

Thanks for your check.

I've fixed the bug in trunk, and have set the Backport field of this ticket.


----------------------------------------
Bug #11738: ARGF.readpartial raises a wrong exception
https://bugs.ruby-lang.org/issues/11738#change-55074

* Author: Shugo Maeda
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-11-09 trunk 52500) [x86_64-linux]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
ARGF.readpartial raises a RuntimeError when EOF is detected more than twice:

```
lexington:ruby$ cat t.rb
p ARGF.readpartial(16) rescue nil
p ARGF.readpartial(16)
lexington:ruby$ ruby t.rb /dev/null
t.rb:2:in `readpartial': can't modify frozen NilClass (RuntimeError)
	from t.rb:2:in `<main>'
lexington:ruby$
```

An EOFError is expected.




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