* [ruby-core:73638] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
@ 2016-02-01 22:52 ` antstorm
2016-03-04 7:24 ` [ruby-core:74130] [Ruby trunk Bug#12044][Closed] " naruse
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: antstorm @ 2016-02-01 22:52 UTC (permalink / raw
To: ruby-core
Issue #12044 has been reported by Anthony Dmitriyev.
----------------------------------------
Bug #12044: net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
https://bugs.ruby-lang.org/issues/12044
* Author: Anthony Dmitriyev
* Status: Open
* Priority: Normal
* Assignee: ruby-core
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Hi there,
I've opened a PR for this issue on GitHub: https://github.com/ruby/ruby/pull/1232
An instance of `NullSocket` is stored in a `@sock` variable of a new `Net::FTP`, it also has a `#close` method (that obviously does nothing), but it is never called, because a wrapping `Net::FTP#close` checks that `@sock and not @sock.closed?` which crashes with `FTPConnectionError` because there is no method `#closed?` on `NullSocket`. This PR adds it and a test to verify that it works.
Below is the way to reproduce the error in the IRB. As you can see it's quite confusing, you'd expect `#closed?` not to raise an error, but return `true` instead.
~~~
>> ftp = Net::FTP.new
=> #<Net::FTP:0x007f90c38075e0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007f90c3807590>, @binary=true, @passive=true, @debug_mode=false, @resume=false, @sock=#<Net::FTP::NullSocket:0x007f90c3807568>, @logged_in=false, @open_timeout=nil, @read_timeout=60>
>> ftp.close
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1168:in `close'
from (irb):6
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
>> ftp.closed?
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1184:in `closed?'
from (irb):7
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:74130] [Ruby trunk Bug#12044][Closed] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
2016-02-01 22:52 ` [ruby-core:73638] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection antstorm
@ 2016-03-04 7:24 ` naruse
2016-03-24 7:19 ` [ruby-core:74511] [Ruby trunk Bug#12044] " usa
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: naruse @ 2016-03-04 7:24 UTC (permalink / raw
To: ruby-core
Issue #12044 has been updated by Yui NARUSE.
Status changed from Open to Closed
fixed at r53810
----------------------------------------
Bug #12044: net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
https://bugs.ruby-lang.org/issues/12044#change-57275
* Author: Anthony Dmitriyev
* Status: Closed
* Priority: Normal
* Assignee: ruby-core
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Hi there,
I've opened a PR for this issue on GitHub: https://github.com/ruby/ruby/pull/1232
An instance of `NullSocket` is stored in a `@sock` variable of a new `Net::FTP`, it also has a `#close` method (that obviously does nothing), but it is never called, because a wrapping `Net::FTP#close` checks that `@sock and not @sock.closed?` which crashes with `FTPConnectionError` because there is no method `#closed?` on `NullSocket`. This PR adds it and a test to verify that it works.
Below is the way to reproduce the error in the IRB. As you can see it's quite confusing, you'd expect `#closed?` not to raise an error, but return `true` instead.
~~~
>> ftp = Net::FTP.new
=> #<Net::FTP:0x007f90c38075e0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007f90c3807590>, @binary=true, @passive=true, @debug_mode=false, @resume=false, @sock=#<Net::FTP::NullSocket:0x007f90c3807568>, @logged_in=false, @open_timeout=nil, @read_timeout=60>
>> ftp.close
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1168:in `close'
from (irb):6
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
>> ftp.closed?
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1184:in `closed?'
from (irb):7
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:74511] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
2016-02-01 22:52 ` [ruby-core:73638] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection antstorm
2016-03-04 7:24 ` [ruby-core:74130] [Ruby trunk Bug#12044][Closed] " naruse
@ 2016-03-24 7:19 ` usa
2016-03-25 9:31 ` [ruby-core:74561] " usa
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: usa @ 2016-03-24 7:19 UTC (permalink / raw
To: ruby-core
Issue #12044 has been updated by Usaku NAKAMURA.
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
Bug #12044: net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
https://bugs.ruby-lang.org/issues/12044#change-57632
* Author: Anthony Dmitriyev
* Status: Closed
* Priority: Normal
* Assignee: ruby-core
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
Hi there,
I've opened a PR for this issue on GitHub: https://github.com/ruby/ruby/pull/1232
An instance of `NullSocket` is stored in a `@sock` variable of a new `Net::FTP`, it also has a `#close` method (that obviously does nothing), but it is never called, because a wrapping `Net::FTP#close` checks that `@sock and not @sock.closed?` which crashes with `FTPConnectionError` because there is no method `#closed?` on `NullSocket`. This PR adds it and a test to verify that it works.
Below is the way to reproduce the error in the IRB. As you can see it's quite confusing, you'd expect `#closed?` not to raise an error, but return `true` instead.
~~~
>> ftp = Net::FTP.new
=> #<Net::FTP:0x007f90c38075e0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007f90c3807590>, @binary=true, @passive=true, @debug_mode=false, @resume=false, @sock=#<Net::FTP::NullSocket:0x007f90c3807568>, @logged_in=false, @open_timeout=nil, @read_timeout=60>
>> ftp.close
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1168:in `close'
from (irb):6
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
>> ftp.closed?
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1184:in `closed?'
from (irb):7
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:74561] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
` (2 preceding siblings ...)
2016-03-24 7:19 ` [ruby-core:74511] [Ruby trunk Bug#12044] " usa
@ 2016-03-25 9:31 ` usa
2016-03-28 16:06 ` [ruby-core:74631] " nagachika00
2016-03-29 7:29 ` [ruby-core:74670] " naruse
5 siblings, 0 replies; 6+ messages in thread
From: usa @ 2016-03-25 9:31 UTC (permalink / raw
To: ruby-core
Issue #12044 has been updated by Usaku NAKAMURA.
Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED
ruby_2_1 r54277 merged revision(s) 53810.
----------------------------------------
Bug #12044: net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
https://bugs.ruby-lang.org/issues/12044#change-57688
* Author: Anthony Dmitriyev
* Status: Closed
* Priority: Normal
* Assignee: ruby-core
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
Hi there,
I've opened a PR for this issue on GitHub: https://github.com/ruby/ruby/pull/1232
An instance of `NullSocket` is stored in a `@sock` variable of a new `Net::FTP`, it also has a `#close` method (that obviously does nothing), but it is never called, because a wrapping `Net::FTP#close` checks that `@sock and not @sock.closed?` which crashes with `FTPConnectionError` because there is no method `#closed?` on `NullSocket`. This PR adds it and a test to verify that it works.
Below is the way to reproduce the error in the IRB. As you can see it's quite confusing, you'd expect `#closed?` not to raise an error, but return `true` instead.
~~~
>> ftp = Net::FTP.new
=> #<Net::FTP:0x007f90c38075e0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007f90c3807590>, @binary=true, @passive=true, @debug_mode=false, @resume=false, @sock=#<Net::FTP::NullSocket:0x007f90c3807568>, @logged_in=false, @open_timeout=nil, @read_timeout=60>
>> ftp.close
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1168:in `close'
from (irb):6
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
>> ftp.closed?
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1184:in `closed?'
from (irb):7
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:74631] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
` (3 preceding siblings ...)
2016-03-25 9:31 ` [ruby-core:74561] " usa
@ 2016-03-28 16:06 ` nagachika00
2016-03-29 7:29 ` [ruby-core:74670] " naruse
5 siblings, 0 replies; 6+ messages in thread
From: nagachika00 @ 2016-03-28 16:06 UTC (permalink / raw
To: ruby-core
Issue #12044 has been updated by Tomoyuki Chikanaga.
Backport changed from 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: DONE, 2.2: DONE, 2.3: REQUIRED
Backported into `ruby_2_2` branch at r54330.
----------------------------------------
Bug #12044: net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
https://bugs.ruby-lang.org/issues/12044#change-57758
* Author: Anthony Dmitriyev
* Status: Closed
* Priority: Normal
* Assignee: ruby-core
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: DONE, 2.2: DONE, 2.3: REQUIRED
----------------------------------------
Hi there,
I've opened a PR for this issue on GitHub: https://github.com/ruby/ruby/pull/1232
An instance of `NullSocket` is stored in a `@sock` variable of a new `Net::FTP`, it also has a `#close` method (that obviously does nothing), but it is never called, because a wrapping `Net::FTP#close` checks that `@sock and not @sock.closed?` which crashes with `FTPConnectionError` because there is no method `#closed?` on `NullSocket`. This PR adds it and a test to verify that it works.
Below is the way to reproduce the error in the IRB. As you can see it's quite confusing, you'd expect `#closed?` not to raise an error, but return `true` instead.
~~~
>> ftp = Net::FTP.new
=> #<Net::FTP:0x007f90c38075e0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007f90c3807590>, @binary=true, @passive=true, @debug_mode=false, @resume=false, @sock=#<Net::FTP::NullSocket:0x007f90c3807568>, @logged_in=false, @open_timeout=nil, @read_timeout=60>
>> ftp.close
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1168:in `close'
from (irb):6
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
>> ftp.closed?
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1184:in `closed?'
from (irb):7
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:74670] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
` (4 preceding siblings ...)
2016-03-28 16:06 ` [ruby-core:74631] " nagachika00
@ 2016-03-29 7:29 ` naruse
5 siblings, 0 replies; 6+ messages in thread
From: naruse @ 2016-03-29 7:29 UTC (permalink / raw
To: ruby-core
Issue #12044 has been updated by Yui NARUSE.
Backport changed from 2.1: DONE, 2.2: DONE, 2.3: REQUIRED to 2.1: DONE, 2.2: DONE, 2.3: DONE
ruby_2_3 r54377 merged revision(s) 53810.
----------------------------------------
Bug #12044: net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection
https://bugs.ruby-lang.org/issues/12044#change-57798
* Author: Anthony Dmitriyev
* Status: Closed
* Priority: Normal
* Assignee: ruby-core
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: DONE, 2.2: DONE, 2.3: DONE
----------------------------------------
Hi there,
I've opened a PR for this issue on GitHub: https://github.com/ruby/ruby/pull/1232
An instance of `NullSocket` is stored in a `@sock` variable of a new `Net::FTP`, it also has a `#close` method (that obviously does nothing), but it is never called, because a wrapping `Net::FTP#close` checks that `@sock and not @sock.closed?` which crashes with `FTPConnectionError` because there is no method `#closed?` on `NullSocket`. This PR adds it and a test to verify that it works.
Below is the way to reproduce the error in the IRB. As you can see it's quite confusing, you'd expect `#closed?` not to raise an error, but return `true` instead.
~~~
>> ftp = Net::FTP.new
=> #<Net::FTP:0x007f90c38075e0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007f90c3807590>, @binary=true, @passive=true, @debug_mode=false, @resume=false, @sock=#<Net::FTP::NullSocket:0x007f90c3807568>, @logged_in=false, @open_timeout=nil, @read_timeout=60>
>> ftp.close
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1168:in `close'
from (irb):6
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
>> ftp.closed?
Net::FTPConnectionError: not connected
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1277:in `method_missing'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/net/ftp.rb:1184:in `closed?'
from (irb):7
from /usr/local/var/rbenv/versions/2.3.0/bin/irb:11:in `<main>'
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-29 6:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-12044.20160201225237@ruby-lang.org>
2016-02-01 22:52 ` [ruby-core:73638] [Ruby trunk Bug#12044] net/ftp.rb: add NullSocket#closed? to fix closing not yet opened connection antstorm
2016-03-04 7:24 ` [ruby-core:74130] [Ruby trunk Bug#12044][Closed] " naruse
2016-03-24 7:19 ` [ruby-core:74511] [Ruby trunk Bug#12044] " usa
2016-03-25 9:31 ` [ruby-core:74561] " usa
2016-03-28 16:06 ` [ruby-core:74631] " nagachika00
2016-03-29 7:29 ` [ruby-core:74670] " naruse
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).