ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:74840] [Ruby trunk Bug#12257] io/wait: wait_readable/writable working different than IO.select when descriptor not open
       [not found] <redmine.issue-12257.20160407124959@ruby-lang.org>
@ 2016-04-07 12:49 ` cardoso_tiago
  2019-06-26 20:12 ` [ruby-core:93371] " merch-redmine
  1 sibling, 0 replies; 2+ messages in thread
From: cardoso_tiago @ 2016-04-07 12:49 UTC (permalink / raw
  To: ruby-core

Issue #12257 has been reported by Tiago Cardoso.

----------------------------------------
Bug #12257: io/wait: wait_readable/writable working different than IO.select when descriptor not open
https://bugs.ruby-lang.org/issues/12257

* Author: Tiago Cardoso
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Coming from this pending issue:

https://github.com/net-ssh/net-ssh/pull/303

Gist of it:

<pre>
f = IO.popen("/bin/sh","r+")
f.close_write
f.wait_writable #=> IOError: not opened for writing
IO.select(nil,[f],nil,10) #=> no error
</pre>

The way I see it, it should have the same behaviour, i.e. either IO.select should complain, or wait_writable should just return nil. 





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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:93371] [Ruby trunk Bug#12257] io/wait: wait_readable/writable working different than IO.select when descriptor not open
       [not found] <redmine.issue-12257.20160407124959@ruby-lang.org>
  2016-04-07 12:49 ` [ruby-core:74840] [Ruby trunk Bug#12257] io/wait: wait_readable/writable working different than IO.select when descriptor not open cardoso_tiago
@ 2019-06-26 20:12 ` merch-redmine
  1 sibling, 0 replies; 2+ messages in thread
From: merch-redmine @ 2019-06-26 20:12 UTC (permalink / raw
  To: ruby-core

Issue #12257 has been updated by jeremyevans0 (Jeremy Evans).


I don't think this is a bug.  It makes sense for `IO#wait_writable` to raise an exception, because the specific `IO` instance will never be writable after `close_write`.  As the documentation for `IO.select` indicates, it calls `select(2)`, and returns arrays showing which `IO` objects you can take action on.  I don't think that it would make sense for `IO.select` to go through all input or output read and write arrays and check if the file descriptors are still open for the appropriate direction.  Even if it could, raising in that case would not be helpful, as you would lose information on which other file descriptors you could take action on.

One thing that may be helpful would be the addition of `IO#read_closed?` and `IO#write_closed?`, as currently I'm not sure how you can determine if an `IO` instance is closed in a given direction.  However, that would be a feature request, not a bug fix.

----------------------------------------
Bug #12257: io/wait: wait_readable/writable working different than IO.select when descriptor not open
https://bugs.ruby-lang.org/issues/12257#change-78895

* Author: chucke (Tiago Cardoso)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Coming from this pending issue:

https://github.com/net-ssh/net-ssh/pull/303

Gist of it:

<pre>
f = IO.popen("/bin/sh","r+")
f.close_write
f.wait_writable #=> IOError: not opened for writing
IO.select(nil,[f],nil,10) #=> no error
</pre>

The way I see it, it should have the same behaviour, i.e. either IO.select should complain, or wait_writable should just return nil. 





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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-26 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-12257.20160407124959@ruby-lang.org>
2016-04-07 12:49 ` [ruby-core:74840] [Ruby trunk Bug#12257] io/wait: wait_readable/writable working different than IO.select when descriptor not open cardoso_tiago
2019-06-26 20:12 ` [ruby-core:93371] " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).