[New-bugs-announce] [issue20418] socket.getaddrinfo fails for hostname that is all digits 0-9
ariel-wikimedia
report at bugs.python.org
Tue Jan 28 13:43:06 CET 2014
New submission from ariel-wikimedia:
With python 2.7.5 (running on fedora 20 with all updates), socket.getaddrinfo for a hostname such as 836937931829 will fail. Docker produces these sorts of hostnames (really random hex strings, but some hex strings only contain digits 0-9).
How to reproduce:
Add the lines
172.17.10.53 blobber
172.17.10.54 836937931829
to /etc/hosts
run the following:
import socket
print socket.getaddrinfo('172.17.10.53',80,socket.AF_INET,0,socket.SOL_TCP)
print socket.getaddrinfo('blobber',80,socket.AF_INET,0,socket.SOL_TCP)
print socket.getaddrinfo('172.17.10.54',80,socket.AF_INET,0,socket.SOL_TCP)
print socket.getaddrinfo('836937931829',80,socket.AF_INET,0,socket.SOL_TCP)
Expected output:
[(2, 1, 6, '', ('172.17.10.53', 80))]
[(2, 1, 6, '', ('172.17.10.53', 80))]
[(2, 1, 6, '', ('172.17.10.54', 80))]
[(2, 1, 6, '', ('172.17.10.54', 80))]
Actual output:
[(2, 1, 6, '', ('172.17.10.53', 80))]
[(2, 1, 6, '', ('172.17.10.53', 80))]
[(2, 1, 6, '', ('172.17.10.54', 80))]
Traceback (most recent call last):
File "./test-getaddrinfo.py", line 6, in <module>
print socket.getaddrinfo('836937931829',80,socket.AF_INET,0,socket.SOL_TCP)
socket.gaierror: [Errno -2] Name or service not known
----------
components: Library (Lib)
messages: 209539
nosy: ariel-wikimedia
priority: normal
severity: normal
status: open
title: socket.getaddrinfo fails for hostname that is all digits 0-9
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20418>
_______________________________________
More information about the New-bugs-announce
mailing list