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.

Author Stijn.Hoop
Recipients BreamoreBoy, Stijn.Hoop, ankitoshniwal, dfranke, loewis, mcjeff
Date 2013-04-16.10:35:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366108525.31.0.437864962387.issue5004@psf.upfronthosting.co.za>
In-reply-to
Content
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.localdomain6

I search in .campus.tue.nl and .win.tue.nl:

[TUE\shoop@pclin281] <~> grep search /etc/resolv.conf 
search campus.tue.nl. win.tue.nl.

Hostname -f reliably returns .campus.tue.nl as it should

[TUE\shoop@pclin281] <~> hostname -f
pclin281.campus.tue.nl
[TUE\shoop@pclin281] <~> hostname -f   
pclin281.campus.tue.nl

But socket.getfqdn disagrees, even with itself when run multiple times:

[TUE\shoop@pclin281] <~> python
Python 2.7.3 (default, Aug  9 2012, 17:23:57) 
[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getfqdn()
'pclin281'
>>> socket.getfqdn()
'pclin281.win.tue.nl'
>>> socket.getfqdn()
'pclin281'
>>> socket.getfqdn()
'pclin281.win.tue.nl'
>>> 

Note that pclin281.win.tue.nl is in fact also a valid DNS entry, but not one that I would expect the function to ever return given the search order.
History
Date User Action Args
2013-04-16 10:35:25Stijn.Hoopsetrecipients: + Stijn.Hoop, loewis, dfranke, mcjeff, BreamoreBoy, ankitoshniwal
2013-04-16 10:35:25Stijn.Hoopsetmessageid: <1366108525.31.0.437864962387.issue5004@psf.upfronthosting.co.za>
2013-04-16 10:35:25Stijn.Hooplinkissue5004 messages
2013-04-16 10:35:24Stijn.Hoopcreate