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: Problem with ftplib on HP-UX11i
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: anthonybaxter, georg.brandl, rptownsend
Priority: normal Keywords:

Created on 2003-09-25 11:10 by rptownsend, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (13)
msg18359 - (view) Author: Richard Townsend (rptownsend) Date: 2003-09-25 11:10
The following code fails on Python 2.3 (and 2.3.1).

import ftplib
f = ftplib.FTP()
f.connect('hostname', 21)

this raises:

socket.gaierror: (8, 'host nor service provided, or not 
known')

In FTP.connect() it is the call to socket.getaddrinfo() 
that is raising the exception.

The same code works OK on Python 2.2.1

If I pass an IP address instead of a hostname, the code 
runs OK on Python 2.3

msg18360 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-26 17:04
Logged In: YES 
user_id=29957

Hm. I wonder if this is related to the configure broken-ness.
Can you apply the workaround from
http://www.python.org/2.3.1/bugs.html and see if the problem
is fixed?
msg18361 - (view) Author: Richard Townsend (rptownsend) Date: 2003-09-26 17:21
Logged In: YES 
user_id=200117

I had already applied the workaround to my 2.3.1 build.

I don't think configure was broken with Python 2.3 - and it 
was with 2.3 that I first noticed the problem.

msg18362 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-26 17:49
Logged In: YES 
user_id=29957

Did the workaround fix the problem? I'm not sure why it'd
work for 2.3 and not 2.3.1, unless 2.3.1's script was
generated with a newer version of autoconf - aha. Yes, it was. 
If you could check if the fix in 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=811160&group_id=5470
"makes it all better", that would be great. Put aclocal.m4
alongside configure &c, re-run autoconf, then ./configure ; make
msg18363 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-26 17:50
Logged In: YES 
user_id=29957

Hm. I'm obviously having reading difficulties. There's
obviously something else going on entirely. Damn. I will try
to grab some time on one of the HP test boxes to see if I
can figure what's going on...
msg18364 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-30 09:44
Logged In: YES 
user_id=29957

Using the HP testdrive system
HP-UX spe169 B.11.11 U 9000/800 1939057856 unlimited-user
license

I did the following with 2.3.2c1:
>>> import ftplib
>>> f = ftplib.FTP()
>>> f.connect('localhost', 21)
'220 spe169.testdrive.hp.com FTP server (Version
1.1.214.4(PHNE_27765) Wed Sep  4 05:59:34 GMT 2002) ready.'
>>> 

Ah. In your example, you have 'hostname'. Is that
_literally_ what you typed? If so, it's looking for a
machine called 'hostname'. I tried that, and got the same
error you got. 

Try it without the single quotes around 'hostname'. 
msg18365 - (view) Author: Richard Townsend (rptownsend) Date: 2003-09-30 12:21
Logged In: YES 
user_id=200117

Apologies for not being clear.

I actually used the real hostname (in quotes) of a workstation 
on our local network in place of 'hostname'.

If I use 'localhost' or the hostname of the workstation the 
application is running on, I don't get the error.

If I use the hostname of any other workstation on the local 
network, I do get the error.

Running exactly the same code on Python 2.2.1 works OK for 
all hostnames.

msg18366 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-30 13:01
Logged In: YES 
user_id=29957

Hm. What's the actual hostname you're trying? I can't get
this failure on HP/UX 11.11, using the HP testdrive box. 

Are you using NIS or some other non-standard method of
hostname lookup? The problem is that there's a fair bit
changed between 2.2 and 2.3's socket module (there was 71
different checkins).
msg18367 - (view) Author: Richard Townsend (rptownsend) Date: 2003-09-30 13:56
Logged In: YES 
user_id=200117

The hostnames I have tried are 'tate_mod' and 'rosalind'.
Lookup is by NIS. I can ping and remote login to these 
workstations using their hostnames.

I have since discovered that if I add an entry to /etc/hosts 
specifying a different hostname 'fred' and rosalind's IP 
address, then f.connect('fred', 21) doesn't give the error.
msg18368 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-30 14:48
Logged In: YES 
user_id=29957

Darn. There's probably something Not Quite Right with how
socketmodule.c interacts with HP/UX's NIS, then. I'm not
sure what the problem would be, and I don't have access to a
HP/UX box that uses NIS for hostnames, so I'm not able to
help... 

As previously mentioned, there's a _lot_ of changes been
made to socketmodule.c between 2.2 and 2.3. If you're
CVS-savvy, you might like to try checking out different
versions between 2.200 (the version in 2.2) and 2.270 (the
version in 2.3) to narrow down exactly when the module stops
working.

One thing - "_" isn't supposed to be legal in domain names,
I don't know if that's related (although the other name has
no underscores...)
msg18369 - (view) Author: Richard Townsend (rptownsend) Date: 2003-10-01 10:11
Logged In: YES 
user_id=200117

I tried dropping different versions of socketmodule.c & 
socketmodule.h into Python-2.3.1 and re-building.

The earliest version of socketmodule.c I could build & run was 
1.219 and this does raise the exception for a hostname that 
needs to be resolved via NIS.
msg18370 - (view) Author: Richard Townsend (rptownsend) Date: 2004-03-24 16:55
Logged In: YES 
user_id=200117

I have just tested this on Python 2.3.3 (sorry about the 
delay) and now it runs with no errors!
msg18371 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-02-20 18:44
Logged In: YES 
user_id=849994

Closing then.
History
Date User Action Args
2022-04-10 16:11:23adminsetgithub: 39301
2003-09-25 11:10:45rptownsendcreate