test_socket.py failure

x2164 at mailcity.com x2164 at mailcity.com
Wed Feb 2 09:49:56 EST 2005


Nick Coghlan <ncoghlan at iinet.net.au> wrote:
> x2164 at mailcity.com wrote:
> >      At the interactive python prompt i did/got the following:
> > 
> >       bash-2.04$ ./python 
> >       Python 2.4 (#1, Jan 29 2005, 10:31:35) 
> >       [GCC 2.95.3 20010315 (release)] on linux2
> >       Type "help", "copyright", "credits" or "license" for 
> >          more information.
> >       >>> import socket
> >       >>> socket.getservbyname('daytime', 'tcp')
> >       13
> >       
> >        # The 13 looks ok but look what happen 
> >        # when i asked only for the service, like
> >        # the line that fails in test_socket.
> >       
> >       >>> socket.getservbyname('daytime')       
> >       Traceback (most recent call last):
> >         File "<stdin>", line 1, in ?
> >       socket.error: service/proto not found
> >       >>>

> Hmm, when the second argument is omitted, the system call looks like:

> getservbyname("daytime", NULL);

> Based on "man getservbyname" on my Linux PC, that should give
> the behaviour we 
> want - any protocol will match.

> However:

> Linux 2.6.4-52-default (Suse 9.1)
> Glibc 2.3.3
> gcc   3.3.3

> So it may be that your older platform doesn't have this
> behaviour - I'd be very 
> interested in what 'man getservbyname' has to say.

> Cheers,
> Nick.

> -- 
> Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
> ---------------------------------------------------------------
>              http://boredomandlaziness.skystorm.net

    hey Nick,

    Just took a look at the man page for getservbyname on this
    system and it doesn't mention passing NULL as the second
    argument.  The pertinents: ;-)

	Linux kernel 2.6.10
	Glibc 2.2.5
        gcc   2.95.3

    I'd say your probably right about there being a difference
    in the behaviour of getservbyname between libc 2.2.5 and 
    and libc-2.3.3 given the differences in man pages and 
    observed return values. I'll try and compare the libcs'
    getservbyname codes and let you know a little later in 
    the day.

    I wonder if the developers wanted to tie the python source
    code so closely to a glibc version and possibly gnu-libc
    specific?

   
    pete jordan
    x2164 at mailcityDOTcom
    miami, florida


-- 
	............




More information about the Python-list mailing list