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

[perl.git] branch smoke-me/jkeenan/ntyni/133928-posix-2nd created.v5.29.8-116-gf88d2382d5

James Keenan via perl5-changes
March 16, 2019 13:07
[perl.git] branch smoke-me/jkeenan/ntyni/133928-posix-2nd created.v5.29.8-116-gf88d2382d5
Message ID:
In perl.git, the branch smoke-me/jkeenan/ntyni/133928-posix-2nd has been created


        at  f88d2382d5111a9fb37d92021aa19c1609273550 (commit)

- Log -----------------------------------------------------------------
commit f88d2382d5111a9fb37d92021aa19c1609273550
Author: Niko Tyni <>
Date:   Sun Mar 10 19:40:42 2019 +0200

    Fix POSIX::mblen mbstate_t initialization on threaded perls with glibc
    As reported in 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
    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
    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 while the existing ones use
    Test::More (and conversion of at least posix.t looks way too involved.)


Perl5 Master Repository Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About