unpack_sockaddr error on UNIX domain sockets since Socket-2.011

Maxime Soulé btik-cpan at scoubidou.com
Thu Feb 20 11:26:53 CET 2014


Hi all,

Socket-2.011 corrected the long standing bug concerning short 
sockaddr_un structures.

Before that, AnyEvent::Socket corrected this by padding these structures 
to the maximal length with nul bytes, as AnyEvent/Socket.pm tells it at 
line 578:
# 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.

But as this bug is corrected in Socket, Socket::unpack_sockaddr_un now 
complains because the sockaddr_un structure has not the size specified 
inside it, in AnyEvent::Socket::unpack_sockaddr:

      Invalid arg sun_len field for Socket::unpack_sockaddr_un, length 
is 106, but sun_len is 16 at .../AnyEvent/Socket.pm line 592.

The attached patch avoid the problem by "patching" such structures only 
when $Socket::VERSION < 2.011...

Best regards,

Max.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AnyEvent-Socket.patch
Type: text/x-patch
Size: 601 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20140220/a8559e4b/attachment.bin>


More information about the anyevent mailing list