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 added
&g
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
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 seti
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
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
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 loca