develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #41121] segmentation fault Running binmode(STDOUT,":encoding(utf8)") with ithreads

Thread Previous
From:
Dan Collins via RT
Date:
July 14, 2016 20:25
Subject:
[perl #41121] segmentation fault Running binmode(STDOUT,":encoding(utf8)") with ithreads
Message ID:
rt-4.0.18-15884-1468527912-591.41121-15-0@perl.org
Fixed by:

0ee3fa26f660ac426e3e082f77d806c9d1471f93 is the first new commit
commit 0ee3fa26f660ac426e3e082f77d806c9d1471f93
Author: Vincent Pit <perl@profvince.com>
Date:   Fri Aug 28 14:17:00 2015 -0300

    Properly duplicate PerlIO::encoding objects

    PerlIO::encoding objects are usually initialized by calling Perl methods,
    essentially from the pushed() and getarg() callbacks. During cloning, the
    PerlIO API will by default call these methods to initialize the duplicate
    struct when the PerlIOBase parent struct is itself duplicated. This does
    not behave so well because the perl interpreter is not ready to call
    methods at this point, for the stacks are not set up yet.

    The proper way to duplicate the PerlIO::encoding object is to call sv_dup()
    on its members from the dup() PerlIO callback. So the only catch is to make
    the getarg() and pushed() calls implied by the duplication of the underlying
    PerlIOBase object aware that they are called during cloning, and make them
    wait that the control flow returns to the dup() callback. Fortunately,
    getarg() knows since its param argument is then non-null, and its return
    value is passed immediately to pushed(), so it is enough to tag this
    returned value with a custom magic so that pushed() can see it is being
    called during cloning.

    This fixes [RT #31923].

:100644 100644 f79df008098f4df1f97f7f104171b89c31049a90 34c2e2436a2a14e776725ca5c40a74c8f0a4bdb7 M      MANIFEST
:040000 040000 ce197fb6173fb13198e80fa4a743778f88a797d4 16376953f016ecdaf6dbe144a432d6d683e00229 M      ext

5.22 is still broken, needs to be backported to next maint release? Testing my test now.

-- 
Respectfully,
Dan Collins

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=41121

Thread Previous


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