After installing the latest perl (perl-5.600-18mdk) IO::Socket seems to
be broken.
The following little program:
use IO::Socket;
my $sock = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "smtp(25)",
Timeout => 60) or die "$0: socket failed [$!]\n";
returns "/home/brian/socktest.pl: socket failed [Operation now in
progress" when run. The same proggie on another system here running
perl 5.00503 works as it always has. It seems that it is IO::Socket
that has changed. The interesting bits of an "strace" of this program
on the system it still works on reveals:
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
[ unimportant stuff deleted ]
connect(4, {sin_family=AF_INET, sin_port=htons(25), sin_addr=inet_addr("127.0.0.1")}},
16) = -1 EINPROGRESS (Operation now in progress)
open("/usr/lib/perl5/5.00503/i386-linux/IO/Select.pm", O_RDONLY) = 8
[ more unimportant stuff removed ]
close(8) = 0
munmap(0x2ac65000, 4096) = 0
fcntl(4, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(4, F_SETFL, O_RDWR) = 0
select(8, NULL, [4], NULL, {60, 0}) = 1 (out [4], left {60, 0})
getpeername(4, {sin_family=AF_INET, sin_port=htons(25),
sin_addr=inet_addr("127.0.0.1")}}, [16]) = 0
As you can see, the old IO::Socket code is doing what a program is
supposed to do when it gets an EINPROGRESS error on a connect(), that is
it has "select()ed" the socket for write to determine the status.
The new IO::Socket code in perl-5.600-18mdk goes right into error code
after the connect() fails:
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 7
[ unimportant stuff deleted ]
connect(7, {sin_family=AF_INET, sin_port=htons(25),
sin_addr=inet_addr("10.75.2.254")}}, 16) = -1 EINPROGRESS (Operation now in progress)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file
or directory)
fcntl(7, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(7, F_SETFL, O_RDWR) = 0
close(7) = 0
munmap(0x40287000, 4096) = 0
close(7) = -1 EBADF (Bad file descriptor)
munmap(0x400e8000, 4096) = 0
write(2, "rlytest: socket failed [Operatio"..., 51rlytest: socket failed [Operation
now in progress]
) = 51
Rather than select()ing like it is supposed to.
b.
--
Brian J. Murrell