Browse code

Fix makeinfo going into a loop for texinfo documents

Change-Id: Ie205ad02bab6846ae99c711a11064c5410fcb0f8
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6089
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>

suezzelur authored on 2018/11/03 05:06:34
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,46 @@
0
+From 9031aefb7f180f718db83aec5e2782079455a32f Mon Sep 17 00:00:00 2001
1
+From: Niko Tyni <ntyni@debian.org>
2
+Date: Sat, 30 Jun 2018 16:51:13 +0100
3
+Subject: [PATCH] Update locale handling for Perl 5.28
4
+
5
+Perl 5.28 introduced thread-safe locales, where setlocale()
6
+only affects the locale of the current thread. External code
7
+like mbrtowc(3) isn't aware of this thread specific locale,
8
+so we need to explicitly modify the global one instead.
9
+
10
+Without this we could enter a busy loop in xspara__add_next()
11
+(Texinfo::Convert::XSParagraph) for UTF-8 documents when mbrtowc(3)
12
+returned -1.
13
+---
14
+ tp/Texinfo/Convert/XSParagraph/xspara.c | 9 +++++++++
15
+ 1 file changed, 9 insertions(+)
16
+
17
+diff --git a/tp/Texinfo/Convert/XSParagraph/xspara.c b/tp/Texinfo/Convert/XSParagraph/xspara.c
18
+index 51eea4a..f2d6d1c 100644
19
+--- a/tp/Texinfo/Convert/XSParagraph/xspara.c
20
+@@ -248,6 +248,11 @@ xspara_init (void)
21
+ 
22
+   dTHX;
23
+ 
24
++#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
25
++  /* needed due to thread-safe locale handling in newer perls */
26
++  switch_to_global_locale();
27
++#endif
28
++
29
+   if (setlocale (LC_CTYPE, "en_US.UTF-8")
30
+       || setlocale (LC_CTYPE, "en_US.utf8"))
31
+     goto success;
32
+@@ -320,6 +325,10 @@ failure:
33
+     {
34
+ success: ;
35
+       free (utf8_locale);
36
++#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
37
++      /* needed due to thread-safe locale handling in newer perls */
38
++      sync_locale();
39
++#endif
40
+       /*
41
+       fprintf (stderr, "tried to set LC_CTYPE to UTF-8.\n");
42
+       fprintf (stderr, "character encoding is: %s\n",
43
+-- 
44
+2.17.0
... ...
@@ -1,13 +1,14 @@
1 1
 Summary:        Reading, writing, and converting info pages
2 2
 Name:           texinfo
3 3
 Version:        6.5
4
-Release:        1%{?dist}
4
+Release:        2%{?dist}
5 5
 License:        GPLv3+
6 6
 URL:            http://ftp.gnu.org/gnu/texinfo/texinfo-%{version}.tar.xz
7 7
 Group:          Applications/System
8 8
 Vendor:         VMware, Inc.
9 9
 Distribution:   Photon
10 10
 Source0:        %{name}-%{version}.tar.xz
11
+Patch0:         texinfo-perl-fix.patch
11 12
 %define sha1    texinfo=72a06b48862911c638787cc3307871b990a59726
12 13
 BuildRequires:  perl
13 14
 
... ...
@@ -16,10 +17,9 @@ The Texinfo package contains programs for reading, writing,
16 16
 and converting info pages.
17 17
 %prep
18 18
 %setup -q
19
+%patch0 -p1
19 20
 %build
20
-./configure \
21
-    --prefix=%{_prefix} \
22
-    --disable-silent-rules
21
+%configure --disable-silent-rules
23 22
 make %{?_smp_mflags}
24 23
 
25 24
 %install
... ...
@@ -54,6 +54,9 @@ rm -rf %{buildroot}%{_infodir}
54 54
 %{_libdir}/texinfo/*
55 55
 
56 56
 %changelog
57
+*   Fri Nov 02 2018 Anish Swaminathan <anishs@vmware.com> 6.5-2
58
+-   Fix texinfo issue with locales
59
+-   http://lists.gnu.org/archive/html/bug-texinfo/2018-06/msg00029.html
57 60
 *   Fri Sep 07 2018 Michelle Wang <michellew@vmware.com> 6.5-1
58 61
 -   Update version to 6.5.
59 62
 *   Fri May 05 2017 Xiaolin Li <xiaolinl@vmware.com> 6.3-3