develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000412.003] Behaviour change in IO::Socket::INET

From:
Brian Raven - Equity Options
Date:
April 12, 2000 08:03
Subject:
[ID 20000412.003] Behaviour change in IO::Socket::INET
Message ID:
200004121503.QAA14320@ssdevws54.liffe.com
This is a bug report for perl from brianr@liffe.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
The behaviour of _sock_info (in IO::Socket::INET.pm) has changed so that
the call will fail if getservbyname fails, even if a valid port number
has been supplied, e.g "pop3(110)". I suggest the following patch:

*** INET.pm.orig	Tue Apr 11 14:56:53 2000
--- INET.pm	Wed Apr 12 15:30:53 2000
***************
*** 34,39 ****
--- 34,40 ----
  
  sub _sock_info {
    my($addr,$port,$proto) = @_;
+   my $origport = $port;
    my @proto = ();
    my @serv = ();
  
***************
*** 59,72 ****
      my $defport = $1 || undef;
      my $pnum = ($port =~ m,^(\d+)$,)[0];
  
!     if ($port =~ m,\D,) {
!       unless (@serv = getservbyname($port, $proto[0] || "")) {
! 	$@ = "Bad service '$port'";
! 	return;
!       }
!     }
  
      $port = $pnum || $serv[2] || $defport || undef;
  
      $proto = (getprotobyname($serv[3]))[2] || undef
  	if @serv && !$proto;
--- 60,73 ----
      my $defport = $1 || undef;
      my $pnum = ($port =~ m,^(\d+)$,)[0];
  
!     @serv = getservbyname($port, $proto[0] || "")
! 	if ($port =~ m,\D,);
  
      $port = $pnum || $serv[2] || $defport || undef;
+     unless (defined $port) {
+ 	$@ = "Bad service '$origport'";
+ 	return;
+     }
  
      $proto = (getprotobyname($serv[3]))[2] || undef
  	if @serv && !$proto;



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
---
Site configuration information for perl v5.6.0:

Configured by cobuild at Mon Mar 27 17:16:22 BST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos jessie 5.6 generic_105181-17 sun4u sparc sunw,ultra-2 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/SUNWspro/SC4.2/lib '
    libpth=/usr/local/lib /opt/SUNWspro/SC4.2/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib -L/opt/SUNWspro/SC4.2/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /connectproducts/local/perl/lib/5.6.0/sun4-solaris
    /connectproducts/local/perl/lib/5.6.0
    /connectproducts/local/perl/lib/site_perl/5.6.0/sun4-solaris
    /connectproducts/local/perl/lib/site_perl/5.6.0
    /connectproducts/local/perl/lib/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/ssdevws54/brianr
    LANG=en_UK
    LANGUAGE (unset)
    LC_COLLATE=en_UK
    LC_CTYPE=en_UK
    LC_MESSAGES=C
    LC_MONETARY=en_UK
    LC_NUMERIC=en_UK
    LC_TIME=en_UK
    LD_LIBRARY_PATH=/home/ssdevws54/brianr/opt/lib::/home/ssdevws54/brianr/connect/ACE/ace:/home/ssdevws54/brianr/connect/common/lib:/home/ssdevws54/brianr/connect/host/lib:/home/ssdevws54/brianr/connect/gateway/lib:/home/ssdevws54/brianr/connect/api/lib:/extra/lifcommon/v6_4/object/SunOS5.6
    LOGDIR (unset)
    PATH=/products/purify:/connectproducts/local/perl/bin:/connectproducts/local/netscape:/connectproducts/local/bin:/home/ssdevws54/brianr/opt/bin:/home/ssdevws54/brianr/connect/bin:/products/SNIFF32/bin:/home/ssdevws54/brianr/bin:.:/bin:/usr/bin:/usr/sbin:/usr/local/bin::/usr/openwin/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/home/ssdevws54/brianr/connect/host/bin:/products/mkssi/sol2:/usr/dt/bin:/home/ssdevws54/brianr/../LDAP/1.0.17/bin:/products/python/Python-1.5.1/bin:/usr/ucb
    PERL_BADLANG (unset)
    SHELL=/usr/bin/ksh



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About