[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2021-10-30 Thread Stijn Hoop
Stijn Hoop added the comment: I hereby put my patch in the public domain and/or under any desired copyright license as required by the Python project to accept it. Regards, Stijn Hoop On Fri, 22 Oct 2021 21:03:26 + Richard van den Berg wrote: > Richard van den Berg ad

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2013-04-19 Thread Stijn Hoop
Stijn Hoop added the comment: So after a good nights sleep: does it not make sense to use the canonical hostname iff the name argument is not present / empty? Otherwise, fall back to the documented steps? That way extra API is avoided, and I can't think of a case where you would rather have

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2013-04-18 Thread Stijn Hoop
Stijn Hoop added the comment: OK, fair enough. From reading sources, it appears that hostname is using getaddrinfo(3) on kernelhostname with hints-ai_flags AI_CANONNAME, while Lib/socket.py simply uses gethostbyaddr(kernelhostname), and falls back on kernelhostname in case of errors

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2013-04-18 Thread Stijn Hoop
Stijn Hoop added the comment: Attached is a very lightly tested patch that matches hostname -f behaviour on my system. I suspect this should be OK but it definitely needs more testing than just my system... -- keywords: +patch Added file: http://bugs.python.org/file29919/python2.7

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2013-04-18 Thread Stijn Hoop
Stijn Hoop added the comment: OK, dumping my current findings here, as I'm still not sure what the expected results should be. First of all, Lib/socket.py calls gethostbyaddr with a name. As in, gethostby _ADDR_ with a name. This works because Modules/socketmodule.c internally uses setipaddr

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2013-04-16 Thread Stijn Hoop
Stijn Hoop added the comment: Still seeing this on Fedora 18 / Python 2.7.3. I only have loopback in /etc/hosts [TUE\shoop@pclin281] ~ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6