Bug #2559: IO#write raises Errno::EINVAL instead of expected Errno::EPIPE
http://redmine.ruby-lang.org/issues/show/2559

Author: Hongli Lai
Status: Open, Priority: Normal
ruby -v: ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin10.2.0]

Test case:

  require 'thread'
  
  a, b = IO.pipe
  Thread.new do
    a.read(1)
    a.close
  end
  
  sleep 0.1  # wait for thread to begin
  b.write("x" * (1024 * 16))  # should be larger than pipe/socket buffer size

b.write on 1.8.7-p174 raises Errno::EPIPE, as expected.
1.8.7-p248 raises Errno::EINVAL.

It looks like this bug was introduced in revision 25918. Unapplying that revision fixes the problem.


----------------------------------------
http://redmine.ruby-lang.org