Package: debconf Version: 1.5.52 Severity: normal Dear Maintainer,
The code in Debconf::FrontEnd::Teletype's display_nowrap silently assumes that the display has more than 2 rows. On a terminal with 2 rows or less, display_nowrap enters an endless loop, since no actual text line is ever displayed, only the prompt itself. I admit this is an extreme corner-case, but the following scenario can bring a whole system down: 1. Launch a debconf-using application in a two-row terminal 2. Kill the parent process while debconf is paging On the next input or signal, the debconf process will spin uncontrollably; reading from STDIN will return immediately due to the broken pipe and as prompt() does not check for errors while reading the response, it will try to display_nowrap("\n") unconditionally, which in turn will call prompt() recursively ad infinitum (or until the system's memory is exhausted). The attached patch fixes the issue. Regards, Apollon -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable'), (90, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores) Locale: LANG=el_GR.UTF-8, LC_CTYPE=el_GR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages debconf depends on: ii perl-base 5.18.2-2+b1 Versions of packages debconf recommends: ii apt-utils 1.0.1 ii debconf-i18n 1.5.52 Versions of packages debconf suggests: ii debconf-doc 1.5.52 ii debconf-utils 1.5.52 ii libgtk2-perl 2:1.249-2 ii libnet-ldap-perl 1:0.6200+dfsg-1 pn libqtcore4-perl <none> pn libqtgui4-perl <none> ii libterm-readline-gnu-perl 1.24-1 ii perl 5.18.2-2+b1 ii whiptail 0.52.15-3+b1 -- debconf-show failed -- Apollon Oikonomopoulos apol...@skroutz.gr Skroutz S.A. http://skroutz.gr
>From d597bd4e8b5de0811be7658d57fe4e1086af69a6 Mon Sep 17 00:00:00 2001 From: Apollon Oikonomopoulos <apoi...@debian.org> Date: Tue, 22 Apr 2014 14:44:38 +0300 Subject: [PATCH] Teletype: page only if screen has more than two rows The code in Debconf::FrontEnd::Teletype's display_nowrap silently assumes that the display has more than 2 rows. On a terminal with 2 rows or less, display_nowrap enters an endless loop, since no actual text line is ever displayed, only the prompt itself. Since there is no point to try paging, we completely skip it for 2-or-less-row-terminals. --- Debconf/FrontEnd/Teletype.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Debconf/FrontEnd/Teletype.pm b/Debconf/FrontEnd/Teletype.pm index df311e7..f8c76c6 100644 --- a/Debconf/FrontEnd/Teletype.pm +++ b/Debconf/FrontEnd/Teletype.pm @@ -90,7 +90,10 @@ sub display_nowrap { # If we had to guess at the screenheight, don't bother # ever pausing; for all I know this is some real teletype # with an infinite height "screen" of fan-fold paper.. - if (! $this->screenheight_guessed && + # Also don't bother pausing if the screenheight is 2 rows or + # less, since that would leave no space to display the actual + # text. + if (! $this->screenheight_guessed && $this->screenheight > 2 && $this->linecount($this->linecount+1) > $this->screenheight - 2) { my $resp=$this->prompt( prompt => '['.gettext("More").']', -- 1.9.2