On Sun, Mar 31, 2019 at 01:56:15PM +0200, intrigeri wrote:
> >From Iain's report I understand that since Perl 5.28, gettext() calls
> are cached, so after switching the locale, in order to get correct
> results, one needs to invalidate the cache somehow, e.g. by calling
> bindtextdomain() and then textdomain().

FWIW I looked into this a bit, and indeed glibc has a cache of
already loaded translations that gets invalidated (by incrementing
_nl_msg_cat_cntr) in setlocale(3), bindtextdomain(3) and textdomain(3)
but not uselocale(3).

Starting with Perl 5.28, Perl uses POSIX 2008 thread-safe locales, so
it calls uselocale(3) underneath when the Perl side POSIX::setlocale()
function is invoked.

The proposed fix/workaround seems fine to me, though I wonder if glibc
should invalidate the cache in uselocale(3) as well. Copying the
glibc maintainers. Any opinion on this?
Niko Tyni   nt...@debian.org

Reply via email to