Forum: Ruby-core [ruby-trunk - Bug #5954][Open] IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)

E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2012-02-01 00:31
(Received via mailing list)
Issue #5954 has been reported by Luis Lavena.

----------------------------------------
Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)
https://bugs.ruby-lang.org/issues/5954

Author: Luis Lavena
Status: Open
Priority: Normal
Assignee: Usaku NAKAMURA
Category:
Target version: 1.9.3
ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev


Originally posted in [ruby-core:42103]:

The following example seems not to work under Windows:

=begin
r, w = IO.pipe

w.write "awesome" * 10

puts r.read_nonblock(8)

r.close
w.close
=end

C:\Users\Luis>ruby -v t.rb
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF)
       from t.rb:5:in `<main>'

What is not clear is that using StringIO works:

=begin
require "stringio"

b = StringIO.new

b.write "awesome" * 10
b.rewind

puts b.read_nonblock(8)

b.close
=end

C:\Users\Luis>ruby -v t2.rb
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
awesomea

Perhaps pipes are not open properly? Is this supported under Windows?
8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 usa (Usaku NAKAMURA) (Guest)
on 2012-07-27 09:51
(Received via mailing list)
Issue #5954 has been updated by usa (Usaku NAKAMURA).

Target version changed from 1.9.3 to 3.0


----------------------------------------
Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)
https://bugs.ruby-lang.org/issues/5954#change-28473

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version: 3.0
ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev


Originally posted in [ruby-core:42103]:

The following example seems not to work under Windows:

=begin
r, w = IO.pipe

w.write "awesome" * 10

puts r.read_nonblock(8)

r.close
w.close
=end

C:\Users\Luis>ruby -v t.rb
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF)
       from t.rb:5:in `<main>'

What is not clear is that using StringIO works:

=begin
require "stringio"

b = StringIO.new

b.write "awesome" * 10
b.rewind

puts b.read_nonblock(8)

b.close
=end

C:\Users\Luis>ruby -v t2.rb
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
awesomea

Perhaps pipes are not open properly? Is this supported under Windows?
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2012-08-07 09:12
(Received via mailing list)
Issue #5954 has been updated by nobu (Nobuyoshi Nakada).

Description updated


----------------------------------------
Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)
https://bugs.ruby-lang.org/issues/5954#change-28703

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version: 3.0
ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev


=begin
Originally posted in [ruby-core:42103]:

The following example seems not to work under Windows:

  r, w = IO.pipe

  w.write "awesome" * 10

  puts r.read_nonblock(8)

  r.close
  w.close

 C:\Users\Luis>ruby -v t.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF)
        from t.rb:5:in `<main>'

What is not clear is that using StringIO works:

  require "stringio"

  b = StringIO.new

  b.write "awesome" * 10
  b.rewind

  puts b.read_nonblock(8)

  b.close

 C:\Users\Luis>ruby -v t2.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 awesomea

Perhaps pipes are not open properly? Is this supported under Windows?
=end
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2013-07-27 02:46
(Received via mailing list)
Issue #5954 has been updated by luislavena (Luis Lavena).


Hello usa, nobu.

I've hit this issue with several project again.

Can you confirm or reject if this failure is intended or a bug? That way
I can decide jump into the code or not (as IO is not my strongest field)

Thank you.

----------------------------------------
Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)
https://bugs.ruby-lang.org/issues/5954#change-40697

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version: Next Major
ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev
Backport:


=begin
Originally posted in [ruby-core:42103]:

The following example seems not to work under Windows:

  r, w = IO.pipe

  w.write "awesome" * 10

  puts r.read_nonblock(8)

  r.close
  w.close

 C:\Users\Luis>ruby -v t.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF)
        from t.rb:5:in `<main>'

What is not clear is that using StringIO works:

  require "stringio"

  b = StringIO.new

  b.write "awesome" * 10
  b.rewind

  puts b.read_nonblock(8)

  b.close

 C:\Users\Luis>ruby -v t2.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 awesomea

Perhaps pipes are not open properly? Is this supported under Windows?
=end
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2013-07-28 03:44
(Received via mailing list)
Issue #5954 has been updated by nobu (Nobuyoshi Nakada).


It's natural.
Windows doesn't support non-blocking mode on other than sockets.
----------------------------------------
Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)
https://bugs.ruby-lang.org/issues/5954#change-40727

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version: Next Major
ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev
Backport:


=begin
Originally posted in [ruby-core:42103]:

The following example seems not to work under Windows:

  r, w = IO.pipe

  w.write "awesome" * 10

  puts r.read_nonblock(8)

  r.close
  w.close

 C:\Users\Luis>ruby -v t.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF)
        from t.rb:5:in `<main>'

What is not clear is that using StringIO works:

  require "stringio"

  b = StringIO.new

  b.write "awesome" * 10
  b.rewind

  puts b.read_nonblock(8)

  b.close

 C:\Users\Luis>ruby -v t2.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 awesomea

Perhaps pipes are not open properly? Is this supported under Windows?
=end
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2013-08-03 22:23
(Received via mailing list)
Issue #5954 has been updated by luislavena (Luis Lavena).

Status changed from Assigned to Rejected

Thank you nobu, this is a platform limitation then.
----------------------------------------
Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)
https://bugs.ruby-lang.org/issues/5954#change-40867

Author: luislavena (Luis Lavena)
Status: Rejected
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version: Next Major
ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev
Backport:


=begin
Originally posted in [ruby-core:42103]:

The following example seems not to work under Windows:

  r, w = IO.pipe

  w.write "awesome" * 10

  puts r.read_nonblock(8)

  r.close
  w.close

 C:\Users\Luis>ruby -v t.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF)
        from t.rb:5:in `<main>'

What is not clear is that using StringIO works:

  require "stringio"

  b = StringIO.new

  b.write "awesome" * 10
  b.rewind

  puts b.read_nonblock(8)

  b.close

 C:\Users\Luis>ruby -v t2.rb
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
 awesomea

Perhaps pipes are not open properly? Is this supported under Windows?
=end
This topic is locked and can not be replied to.