mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-06 02:17:34 -08:00
dev-perl/Text-WrapI18N: fix build hang of app-text/po4a
Text::WrapI18N has a bug that causes an infinite loop. The following
program demonstrates the issue:
> use Text::WrapI18N qw($columns);
> use Text::WrapI18N qw(wrap);
> $columns = 78;
>
> my $a="po/pod.cfg:1: ";
> my $b=" ";
> my $c="No PO files found in '/var/tmp/portage/app-text/po4a-0.74-r1/work/po4a-0.74'/'po/pod'.";
>
> print wrap($a, $b, $c);
This program will hang indefinitely until OOM. However, if change $columns to
any value greater than 78, it finishes quickly.
In po4a, $columns is set from $ENV{COLUMNS} ( see
https://github.com/mquinson/po4a/blob/master/lib/Locale/Po4a/Common.pm#L68),
so if your terminal width is <= 78, emerge will hang.
This is a very old bug that Debian found and fixed in 2008. See
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=470250
and upstream issue:
https://rt.cpan.org/Public/Bug/Display.html?id=42102
Closes: https://bugs.gentoo.org/959830
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/44680
Closes: https://github.com/gentoo/gentoo/pull/44680
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
5294e2961a
commit
d9a3e8ab7a
18
dev-perl/Text-WrapI18N/Text-WrapI18N-0.60.0-r3.ebuild
Normal file
18
dev-perl/Text-WrapI18N/Text-WrapI18N-0.60.0-r3.ebuild
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DIST_AUTHOR=KUBOTA
|
||||
DIST_VERSION=0.06
|
||||
inherit perl-module
|
||||
|
||||
DESCRIPTION="Internationalized substitute of Text::Wrap"
|
||||
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
|
||||
RDEPEND="dev-perl/Text-CharWidth"
|
||||
BDEPEND="${RDEPEND}"
|
||||
|
||||
PATCHES=( "${FILESDIR}"/${PN}-fix-endless-loop.patch )
|
||||
@ -0,0 +1,26 @@
|
||||
patch is extracted from debian:
|
||||
https://deb.debian.org/debian/pool/main/libt/libtext-wrapi18n-perl/libtext-wrapi18n-perl_0.06-10.debian.tar.xz
|
||||
|
||||
Description: The infinite loop occurs in Text::WrapI18N when po4a tries to report an error in the PO files.
|
||||
I could reproduce the problem in WrapI18N::wrap() and I propose the
|
||||
attached patch to WrapI18N::wrap(). (A word should be placed on the
|
||||
next line if it fits on this line, but the leading header must be taken
|
||||
into account, thus $columns -> $columns - length $header)
|
||||
Origin: vendor
|
||||
Bug-Debian: https://bugs.debian.org/470250
|
||||
Forwarded: unknown
|
||||
Author: Nicolas François <nicolas.francois@centraliens.net>
|
||||
Reviewed-by: gregor herrmann <gregoa@debian.org>
|
||||
Last-Update: 2019-03-21
|
||||
|
||||
--- a/WrapI18N.pm 2003-06-25 11:14:25.000000000 +0200
|
||||
+++ b/WrapI18N.pm 2008-03-13 02:04:02.628000837 +0100
|
||||
@@ -88,7 +88,7 @@ sub wrap {
|
||||
$len = 0;
|
||||
$text = $top2 . $text;
|
||||
$word = ''; $wlen = 0;
|
||||
- } elsif ($wlen + $w <= $columns) {
|
||||
+ } elsif ($wlen + $w <= $columns - length ($top2)) {
|
||||
# the current word is sent to next line
|
||||
$out .= $separator;
|
||||
$len = 0;
|
||||
Loading…
x
Reference in New Issue
Block a user