Backport #2559 [ruby-core:27425]
IO#write raises Errno::EINVAL instead of expected Errno::EPIPE
| Status : | Assigned | Start : | 01/06/2010 | |
| Priority : | Normal | Due date : | ||
| Assigned to : | Shyouhei Urabe | % Done : | 100% |
|
| Category : | - | |||
| Target version : | - | |||
Description
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.
Associated revisions
- io.c (io_fwrite): preserve errno. [ruby-core:27425]
History
01/06/2010 03:37 AM - Hongli Lai
- File io-write-fix.diff added
Attached patch fixes the problem. Includes unit test.
01/08/2010 06:57 PM - Nobuyoshi Nakada
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r26253. Hongli, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.
01/09/2010 10:03 AM - Nobuyoshi Nakada
- Status changed from Closed to Assigned
- Assigned to set to Shyouhei Urabe
02/05/2010 08:07 AM - Eric Wong
Nobuyoshi Nakada <redmine@ruby-lang.org> wrote: > Issue #2559 has been updated by Nobuyoshi Nakada. > > Status changed from Open to Closed > % Done changed from 0 to 100 > > This issue was solved with changeset r26253. This affects a FreeBSD user on 1.8.7-p248. Can somebody please backport this to the 1.8.7 branch? Thanks -- Eric Wong