This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_socket.test_host_resolution_bad_address fails on Mac OS X 10.13.6
Type: behavior Stage: resolved
Components: macOS, Tests Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: lys.nikolaou, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2018-07-12 18:49 by lys.nikolaou, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (6)
msg321575 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2018-07-12 18:49
On my Mac OS X 10.13.6 system test_socket.test_host_resolution_bad_address fails with the following error:

======================================================================
FAIL: test_host_resolution_bad_address (test.test_socket.GeneralModuleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/path/to/cpython/Lib/test/test_socket.py", line 897, in test_host_resolution_bad_address
    socket.gethostbyname(addr)
AssertionError: OSError not raised : 0.1.1.~1

----------------------------------------------------------------------
Ran 555 tests in 24.950s

FAILED (failures=1, skipped=141)
/path/to/cpython/Lib/test/test_socket.py:2345: RuntimeWarning: received malformed or improperly-truncated ancillary data
  result = sock.recvmsg(bufsize, *args)
/path/to/cpython/Lib/test/test_socket.py:2436: RuntimeWarning: received malformed or improperly-truncated ancillary data
  result = sock.recvmsg_into([buf], *args)
test test_socket failed

== Tests result: FAILURE ==

1 test failed:
    test_socket

Total duration: 25 sec 423 ms
Tests result: FAILURE

When I manually run socket.gethostbyname('0.1.1.~1'), it returns an IP address, no exception thrown.
msg322987 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2018-08-02 18:34
Is this expected behaviour, should the tests be changes, or is it a bug?
msg322990 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-08-02 20:08
This is not expected, but I don't know where the problem is.

On my machine I get:

>>> socket.gethostbyname('0.1.1.~1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

This is on a machine running 10.13.6:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G65

I'm using a checkout of master of about a week all, and get the same exception with 3.7.0.  I also get the same exception on the current beta of macOS 10.14 (With python 3.7.0)

I'm currently building the current master to check if that changes anything.
msg322992 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-08-02 20:12
Note that the test itself has the following comment:

def test_host_resolution_bad_address(self):
        # These are all malformed IP addresses and expected not to resolve to
        # any result.  But some ISPs, e.g. AWS, may successfully resolve these
        # IPs.


Does the following shell command give an error? : host '0.1.1.~1'
msg322996 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2018-08-02 22:59
When running the terminal command host '0.1.1.~1' I get the following output:

0.1.1.~1 has address 62.138.239.45
0.1.1.~1 has address 62.138.238.45
Host 0.1.1.~1 not found: 3(NXDOMAIN)
Host 0.1.1.~1 not found: 3(NXDOMAIN)

If I ping the above IP address 62.138.239.45, it does not respond.
msg323025 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-08-03 05:45
For some reason your system resolves invalid names, likely due to some upstream nameserver misbehaving.

Is your Internet provider T-Online in Germany? The address 62.138.239.45 is registered to that company, the IP address also appears to host some kind of search page. This is sadly behaviour of some Internet provider: provide a DNS server to customers that won't return "domain not found", but returns a search page with advertising instead.

All in all I think this is not a bug in Python.
History
Date User Action Args
2022-04-11 14:59:03adminsetgithub: 78286
2019-07-14 13:01:08ronaldoussorensetstatus: pending -> closed
stage: resolved
2019-05-06 15:50:55SilentGhostlinkissue36815 superseder
2018-08-03 05:45:10ronaldoussorensetstatus: open -> pending
resolution: not a bug
messages: + msg323025
2018-08-02 22:59:21lys.nikolaousetmessages: + msg322996
2018-08-02 20:12:46ronaldoussorensetassignee: ronaldoussoren
2018-08-02 20:12:26ronaldoussorensetmessages: + msg322992
2018-08-02 20:08:49ronaldoussorensetmessages: + msg322990
2018-08-02 18:50:45berker.peksagsetnosy: + ned.deily, ronaldoussoren
components: + macOS
2018-08-02 18:34:18lys.nikolaousetmessages: + msg322987
2018-07-12 18:49:50lys.nikolaoucreate