Feature #17944
closedRemove Socket.gethostbyaddr and Socket.gethostbyname
Description
It is marked as unsafe by our static analysis. Can it be removed now?
It was deprecated in:
https://bugs.ruby-lang.org/projects/ruby-master/repository/trunk/revisions/60266
https://bugs.ruby-lang.org/issues/13097
Updated by jaruga (Jun Aruga) about 2 years ago
ยท Edited
The commit for the deprecated documents was added in 2017.
Deprecation document for gethostbyname,gethostbyaddr.
https://github.com/ruby/ruby/commit/b5c6fc856100b17b6f20e6e792a02ee7e33306bc
Date: Sat Oct 21 13:13:02 2017 +0000
The commit for printng warning messages was added in 2020.
Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddr
https://github.com/ruby/ruby/commit/6d946665bd79a93fb98b2d25400d1b6174472302
Date: Sat Aug 29 17:18:59 2020 +0900
If we are hesitate to drop the functions, we may be able to drop the functions conditionally with the configure option(s) like this.
or
Updated by Earlopain (Earlopain _) about 1 month ago
- Related to Feature #13097: Deprecate Socket.gethostbyaddr and Socket.gethostbyname added
Updated by Earlopain (Earlopain _) about 1 month ago
ruby/spec has the following test:
addr = IPAddr.new('::1').hton
it 'raises SocketError when the address is not supported by the family' do
-> { suppress_warning { Socket.gethostbyaddr(addr, :INET) } }.should.raise(SocketError)
end
But it doesn't raise and instead returns the following result for me: ["pi.hole", [], 2, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"].
Given https://github.com/ruby/ruby/commit/41977ef59585d1ee42ffcb546aa80f071512b257, it doesn't look I am the only one this happened to.
They print warnings for ~6 years now, so it seems wasted time to investigate this. Can we simply remove them now?
Updated by matz (Yukihiro Matsumoto) 24 days ago
It didn't seem like anyone was using them, and since they weren't good API to begin with (they had Perl-like design), I felt it was okay to remove them.
Matz.
Updated by nobu (Nobuyoshi Nakada) 24 days ago
- Status changed from Open to Closed
Applied in changeset git|221c7c6644f61cf329f6cbaf5924e52917cdc2a7.
[Feature #17944] Remove deprecated socket methods
These methods have been deprecated since nine years ago.