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

binmode(IO, ':unix') and open(IO, '+>:unix', undef) leak

Thread Next
From:
Eric Wong
Date:
January 24, 2020 11:23
Subject:
binmode(IO, ':unix') and open(IO, '+>:unix', undef) leak
Message ID:
20200124112253.GA1632@dcvr
Hello, I'm getting FD leaks from setting the ":unix" IO layer
using either open(..., '+>:unix', undef) or binmode(IO, ':unix').

I've reproduced it in current blead[1], 5.24.1 (Debian 9),
5.28.1 (Debian 10), and 5.30.1 (FreeBSD 11).

[1] blead @ fb953ad4077a4a0f7b8204f52f3ce71feca190d2
    ("win32: don't set the base address of perl5xx.dll")

Something seems being accounted for wrong, since
:unix already exists and the PerlIOUnix_setfd refcnt
bump is being triggered again.

I'm using :unix so the read() perlfunc can pass the length arg
down to the read(2) syscall, and avoiding sysread() since I
want my code to be PerlIO::scalar-compatible.

See attached script for reproducer.  Thanks.

Thread Next


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