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

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

Petter Reinholdtsen
September 30, 2000 19:57
[ID 20000930.001] Bug in perl 5.00503 IO::Socket
Message ID:

This is a bug report for perl from,
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/ Sat Sep 30 19:12:56 2000
+++ IO/      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:
    osname=linux, osvers=2.2.5-22smp, archname=i386-linux
    uname='linux 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
    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:

Environment for perl 5.00503:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/zsh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About