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

[ID 20000127.004] Unix Domain sockaddr returned by recv is notacceptable to Socket::unpack_sockaddr_un

Thread Previous
From:
Ben Coleman
Date:
January 27, 2000 19:05
Subject:
[ID 20000127.004] Unix Domain sockaddr returned by recv is notacceptable to Socket::unpack_sockaddr_un
Message ID:
200001280304.DAA04933@nj8j.home

This is a bug report for perl from oloryn@mindspring.com,
generated with the help of perlbug 1.26 running under perl 5.00503.


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

Run this perl program:

-----
#!/usr/bin/perl -w

use Socket;

socket(SERVER, AF_UNIX, SOCK_DGRAM, 0);
bind(SERVER, pack_sockaddr_un('/tmp/server'));

$sock_addr = recv(SERVER, $message, 256, 0);
$sock_path = unpack_sockaddr_un($sock_addr);
print "$sock_path\n";
print "$message\n";
-----

and then run this one to send a message to the first:

-----
#!/usr/bin/perl -w

use Socket;

socket(CLIENT, AF_UNIX, SOCK_DGRAM, 0);
bind(CLIENT, pack_sockaddr_un('/tmp/client'));

send(CLIENT, 'Test message', 0, pack_sockaddr_un('/tmp/server'));
-----

and the first will die with the message

Bad arg length for Socket::unpack_sockaddr_un, length is 14, should be 110 at udtest.srv line 9.

If Socket::unpack_sockaddr_un is going to expect a 110-byte long Unix Domain 
sockaddr, shouldn't recv be returning one?  Either Socket::unpack_sockaddr_un
or recv needs to be fixed.

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

---
Site configuration information for perl 5.00503:

Configured by root at Sun Jul 18 14:58:08 CDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.6, archname=i386-linux
    uname='linux xyzzy 2.2.6 #2 wed jun 16 15:23:52 cdt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', 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 /shlib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -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/i386-linux
    /usr/lib/perl5
    /usr/lib/perl5/site_perl/i386-linux
    /usr/lib/perl5/site_perl
    .

---
Environment for perl 5.00503:
    HOME=/home/oloryn
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/oloryn/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games:.:/usr/share/texmf/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Thread Previous


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