Bug#329291: abstract family sockets are broken

Lubomir Rintel lkundrak at v3.sk
Wed Aug 26 12:51:34 UTC 2009


Hi Marco,

> Even if it's supposed to support abstract AF_UNIX sockets,
> Socket::pack_sockaddr_un pads the structure with NULs, which makes the
> address different.

This probably describes the same issue as
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=490660

The fix was queued into Bleadperl, it's relatively small and safe; in
case you want to cherry-pick it:

http://perl5.git.perl.org/perl.git/commitdiff/99f13d4c3419e967e95c5ac6a3af61e9bb0fd3c0

The workaround would be as follows:

# Native sockaddr_un might be broken in Perl's Socket.xs,
# dispatch to replacement if it is the case
*sockaddr_un_native = \&sockaddr_un;
*sockaddr_un = sub {
        my $address = shift;
        if (length ($address) + 2 == length (sockaddr_un_native ($@))) {
                *sockaddr_un = \&sockaddr_un_native;
        } else {
                *sockaddr_un = sub { "\x01\x00".shift };
        }
        return (sockaddr_un ($address, @_));
};

Best Regards,
Lubo

--
Fedora 12 Alpha is out. Get it while it's hot! 
http://fedoraproject.org/get-prerelease







More information about the Perl-maintainers mailing list