gtexinfo: fix infinite loop in makeinfo with perl-5.28

patch from Niko Tyni via upstream mailing list
This commit is contained in:
tnn 2018-08-30 11:27:48 +00:00
parent c4cd15d75a
commit f7419c7bbc
3 changed files with 48 additions and 3 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.99 2018/08/30 11:03:34 tnn Exp $
# $NetBSD: Makefile,v 1.100 2018/08/30 11:27:48 tnn Exp $
DISTNAME= texinfo-6.5
PKGNAME= g${DISTNAME}
PKGREVISION= 2
PKGREVISION= 3
CATEGORIES= devel sysutils
MASTER_SITES= ${MASTER_SITE_GNU:=texinfo/}

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.53 2018/08/30 11:03:34 tnn Exp $
$NetBSD: distinfo,v 1.54 2018/08/30 11:27:48 tnn Exp $
SHA1 (texinfo-6.5.tar.gz) = 0f8e69781e28ec102b6a9487b093c440f5bb8545
RMD160 (texinfo-6.5.tar.gz) = cfa624ad3572c21d201bb4c734aae19cd8785e88
@ -11,6 +11,7 @@ SHA1 (patch-gnulib_lib_mbuiter.h) = be293674c37cb91746527be07aa40acbd285d2f4
SHA1 (patch-texindex_texindex.awk) = 1f022f1495c951337997036ef1cd758ef9c116a7
SHA1 (patch-tp_Texinfo_Convert_XSParagraph_Makefile.in) = cdb6c78c2c15d3f8ee5755625694c11ecd9004e9
SHA1 (patch-tp_Texinfo_Convert_XSParagraph_configure) = d4557bae4417cd42297bceaa76478b00b3875df3
SHA1 (patch-tp_Texinfo_Convert_XSParagraph_xspara.c) = ba679fcd739382ad20babe2241c6504e45b69273
SHA1 (patch-tp_Texinfo_MiscXS_Makefile.in) = fdf3a4d6f81bdeb03cbf156b77a1510e2f6baf9e
SHA1 (patch-tp_Texinfo_Parser.pm) = d3e4ed3ab0fca4a9d017ee65608ea66ee85b28ac
SHA1 (patch-util_texi2dvi) = c894eb109ef3faa7ed1cb544556ca6a97af439e9

View file

@ -0,0 +1,44 @@
$NetBSD: patch-tp_Texinfo_Convert_XSParagraph_xspara.c,v 1.3 2018/08/30 11:27:48 tnn Exp $
>From 9031aefb7f180f718db83aec5e2782079455a32f Mon Sep 17 00:00:00 2001
From: Niko Tyni <address@hidden>
Date: Sat, 30 Jun 2018 16:51:13 +0100
Subject: [PATCH] Update locale handling for Perl 5.28
Perl 5.28 introduced thread-safe locales, where setlocale()
only affects the locale of the current thread. External code
like mbrtowc(3) isn't aware of this thread specific locale,
so we need to explicitly modify the global one instead.
Without this we could enter a busy loop in xspara__add_next()
(Texinfo::Convert::XSParagraph) for UTF-8 documents when mbrtowc(3)
returned -1.
---
tp/Texinfo/Convert/XSParagraph/xspara.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- tp/Texinfo/Convert/XSParagraph/xspara.c.orig 2017-06-18 15:38:01.000000000 +0000
+++ tp/Texinfo/Convert/XSParagraph/xspara.c
@@ -248,6 +248,11 @@ xspara_init (void)
dTHX;
+#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
+ /* needed due to thread-safe locale handling in newer perls */
+ switch_to_global_locale();
+#endif
+
if (setlocale (LC_CTYPE, "en_US.UTF-8")
|| setlocale (LC_CTYPE, "en_US.utf8"))
goto success;
@@ -320,6 +325,10 @@ failure:
{
success: ;
free (utf8_locale);
+#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
+ /* needed due to thread-safe locale handling in newer perls */
+ sync_locale();
+#endif
/*
fprintf (stderr, "tried to set LC_CTYPE to UTF-8.\n");
fprintf (stderr, "character encoding is: %s\n",