develooper Front page | perl.perl5.changes | Postings from March 2019

[perl.git] branch smoke-me/jkeenan/ntyni/133928-posix created.v5.29.8-84-g9047dc36a5

From:
James Keenan via perl5-changes
Date:
March 13, 2019 21:27
Subject:
[perl.git] branch smoke-me/jkeenan/ntyni/133928-posix created.v5.29.8-84-g9047dc36a5
Message ID:
E1h4BOx-0007TY-1S@git.dc.perl.space
In perl.git, the branch smoke-me/jkeenan/ntyni/133928-posix has been created

<https://perl5.git.perl.org/perl.git/commitdiff/9047dc36a542ea1e74efbcf1eaae89a05af53e36?hp=0000000000000000000000000000000000000000>

        at  9047dc36a542ea1e74efbcf1eaae89a05af53e36 (commit)

- Log -----------------------------------------------------------------
commit 9047dc36a542ea1e74efbcf1eaae89a05af53e36
Author: Niko Tyni <ntyni@debian.org>
Date:   Sun Mar 10 19:40:42 2019 +0200

    Fix POSIX::mblen mbstate_t initialization on threaded perls with glibc
    
    As reported in https://bugs.launchpad.net/bugs/1818953 POSIX::mblen()
    is broken on threaded perls with glibc.
    
      % perl -MPOSIX=mblen -e 'mblen("a", 1)'
      perl: mbrtowc.c:105: __mbrtowc: Assertion `__mbsinit (data.__statep)' failed.
      zsh: abort (core dumped)  perl -MPOSIX=mblen -e 'mblen("a", 1)'
    
    This broke in v5.27.8-134-g6c9ff7e96e which made the function
    use mbrlen(3) under the hood on threaded perls.
    
    The problem is initialization of the shift state with
    
      mbrlen(NULL, 0, &ps));
    
    The glibc documentation for mbrlen(3) at
    
      https://www.gnu.org/software/libc/manual/html_node/Converting-a-Character.html#Converting-a-Character
    
    does not mention initialization by passing in a null pointer for the
    string, only a pointer to a NUL wide character.
    
       If the next multibyte character corresponds to the NUL wide character,
       the return value is 0. If the next n bytes form a valid multibyte
       character, the number of bytes belonging to this multibyte character
       byte sequence is returned.
    
    Use memset(3) instead for mbstate_t initialization, as suggested in
    
      https://www.gnu.org/software/libc/manual/html_node/Keeping-the-state.html
    
    with the hope that this is more portable.
    
    While at it, add a few basic test cases. These are in a new file because
    they need fresh_perl_is() from test.pl while the existing ones use
    Test::More (and conversion of at least posix.t looks way too involved.)
    
    Bug-Ubuntu: https://bugs.launchpad.net/bugs/1818953

-----------------------------------------------------------------------

-- 
Perl5 Master Repository



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