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

[ID 20000930.001] Bug in perl 5.00503 IO::Socket

From:
Petter Reinholdtsen
Date:
September 30, 2000 19:57
Subject:
[ID 20000930.001] Bug in perl 5.00503 IO::Socket
Message ID:
200010010257.KAA05735@localhost.localdomain

This is a bug report for perl from pere@td.org.uit.no,
generated with the help of perlbug 1.26 running under perl 5.00503.

-----------------------------------------------------------------
[Please enter your report here]

After hours of debugging, I finally found the source of my current
perl problems in IO::Socket.  There is a bug in
IO::Socket::UNIX::configure which makes it impossible to make a UNIX
Domain Socket SOCK_DGRAM server using this class.

The problem is a call to listen() if the Listen argument is specified.
Specifying Listen is the only way to tell this class to make a server
socket, but the listen() call should only be called for SOCK_STREAM
and SOCK_SEQPACKET sockets, not SOCK_DGRAM.  With the following patch
I was able to get my perl implementation of syslogd working. :-)

This was discovered using perl-5.00503-12 RPM included in RedHat 6.2.
I believe the IO::Socket version number is 1.1603.

--- IO/Socket.pm.orig Sat Sep 30 19:12:56 2000
+++ IO/Socket.pm      Sat Sep 30 19:14:01 2000
@@ -685,8 +685,10 @@
            return undef;
     }
     if(exists $arg->{Listen}) {
-       $fh->listen($arg->{Listen} || 5) or
-           return undef;
+        if ($type == SOCK_STREAM || $type == SOCK_SEQPACKET) {
+           $fh->listen($arg->{Listen} || 5) or
+               return undef;
+        }
     }
     elsif(exists $arg->{Peer}) {
        my $addr = sockaddr_un($arg->{Peer});

[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by root at Thu Aug 10 15:31:56 EDT 2000.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.5-22smp, archname=i386-linux
    uname='linux porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2 09:11:51 ed
t 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2 -m486 -fno-strength-reduce', gccversion=egcs-2.91.66
19990314/Linux (egcs-1.1.2 release)
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:


---
@INC for perl 5.00503:
    /usr/lib/perl5/5.00503/i386-linux
    /usr/lib/perl5/5.00503
    /usr/lib/perl5/site_perl/5.005/i386-linux
    /usr/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00503:
    HOME=/home/pere
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/store/opt/kde/bin:/home/pere/gnu/bin:/home/pere/gnu/wine/bin:/tmp/kaff
e/bin:/store/bin:/sbin:/bin:/usr/sbin:/usr/bin:/store/sbin:/store/opt/uwarobot/c
md:/usr/bin/X11:/etc:/usr/etc:/store/jdk/bin:/store/opt/uwarobot/i386-Linux/bin:
/usr/X11R6/bin:/usr/local/bin:/store/opt/gdb-bdm/bin:/store/opt/uwarobot/g++-m68
k/bin:/home/pere/bin
    PERL_BADLANG (unset)
    SHELL=/bin/zsh




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