Socket::unpack_sockaddr_in error and fixes
Michael Fung
mike at cmsweb.com
Mon Oct 6 08:21:34 CEST 2014
Dear Marc,
My tcp server ran happily for a few months and died with:
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16
at
/opt/perlbrew/perls/perl-5.14.4/lib/site_perl/5.14.4/x86_64-linux/Socket.pm
line 830.
I am running AnyEvent 7.07. Should I apply the following patch to fix it?
http://cvs.schmorp.de/AnyEvent/lib/AnyEvent/Socket.pm?r1=1.163&r2=1.164
[code]
--- Socket.pm 2014/02/16 16:20:45 1.163
+++ Socket.pm 2014/02/21 16:22:18 1.164
@@ -578,8 +578,14 @@
# perl contains a bug (imho) where it requires that the kernel always
returns
# sockaddr_un structures of maximum length (which is not, AFAICS, required
# by any standard). try to 0-pad structures for the benefit of those
platforms.
+# unfortunately, the IO::Async author chose to break Socket again in
version
+# 2.011 - it now contains a bogus length check, so we disable the
workaround.
-my $sa_un_zero = eval { Socket::pack_sockaddr_un "" }; $sa_un_zero ^=
$sa_un_zero;
+my $sa_un_zero = $Socket::VERSION >= 2.011
+ ? ""
+ : eval { Socket::pack_sockaddr_un "" };
+
+$sa_un_zero ^= $sa_un_zero;
sub unpack_sockaddr($) {
my $af = sockaddr_family $_[0];
[/code]
Thanks and Regards,
Michael
More information about the anyevent
mailing list