Project

General

Profile

Actions

Bug #12230

closed

Wrong exception raised when IO.read from a pipe is passed an offset on Windows

Added by vais (Vais Salikhov) over 8 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
[ruby-core:74724]

Description

When IO.read from a pipe is passed an offset, the expected exception is Errno::ESPIPE, but on Windows Invalid argument (Errno::EINVAL) is raised instead:

C:\Users\Administrator\Desktop>C:\Ruby\ruby-2.2.4-i386-mingw32\bin\ruby.exe -ve "p IO.read('|cmd.exe /C echo hello', 1, 1)"
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
The process tried to write to a nonexistent pipe.
-e:1:in `read': Invalid argument (Errno::EINVAL)
        from -e:1:in `<main>'

Files

win32-seek-espipe.patch (1.17 KB) win32-seek-espipe.patch jeremyevans0 (Jeremy Evans), 07/24/2019 06:43 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #15199: scanf.rb broken with io from IO.pipe (MinGW or Windows?)ClosedActions

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

I think we should fix this to make the behavior on Windows consistent with other operating systems. Attached is a patch that attempts to do so. I'm not sure if the approach the patch takes is the best way to fix this. I also don't have a compilation environment on Windows, so a committer that does should probably check that the patch works.

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Status changed from Open to Closed

Applied in changeset git|0a63c4d5fbbbfae9aba92c78e39b1521b90f1b06.


Fix errno at seeking socket/pipe on Windows

[Bug #12230]

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Related to Bug #15199: scanf.rb broken with io from IO.pipe (MinGW or Windows?) added
Actions #4

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0