Issue #11441 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONTNEED to 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONTNEED

ruby_2_1 r51612 merged revision(s) 44497.

----------------------------------------
Bug #11441: Ruby 2.1 で TCPServer.new(port) がエラーになる場合 TypeError になる
https://bugs.ruby-lang.org/issues/11441#change-53826

* Author: Masahiro Tomita
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
* Backport: 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONTNEED
----------------------------------------
`TCPServer.new(port)` がエラーになる場合、Ruby 2.1 だけ TypeError になってしまいます。

```
% ruby -v -rsocket -e 'TCPServer.new(123)'
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
-e:1:in `initialize': no implicit conversion of nil into String (TypeError)
	from -e:1:in `new'
	from -e:1:in `<main>'
```

Ruby 2.0.0, 2.2 ではちゃんと適切なエラーになります。

```
% ruby -v -rsocket -e 'TCPServer.new(123)'
ruby 2.0.0p576 (2014-09-19 revision 47628) [x86_64-linux]
-e:1:in `initialize': Permission denied - bind(2) (Errno::EACCES)
	from -e:1:in `new'
	from -e:1:in `<main>'

% ruby -v -rsocket -e 'TCPServer.new(123)' 
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
-e:1:in `initialize': Permission denied - bind(2) for nil port 123 (Errno::EACCES)
	from -e:1:in `new'
	from -e:1:in `<main>'
```



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