Package: dialog
Version: 1.3-20190211-1
Severity: normal
Tags: patch

As originally reported in #930775, the dialog program aborts with an exit 
status of
255 after resizing a widget. This is due to the dlg_win_resize function (util.c)
configuring an input timeout of 0.02s which is then left in place, causing the 
next
regular character read (via dlg_getc in ui_getc.c) to fail with a timeout the 
code
isn't prepared to handle. The orignal command for triggering this was

dialog --msgbox Text 0 0

Supposedly, this issue is fixed in 1.3-20190808-1 but this isn't the case: The 
relevant
change in there ignores getc errors after a resize until some key event is 
received.
Because of this, the bug can no longer be triggered via msgbox as the only key 
event
processed by that cause the program to exit. It's still possible to trigger the 
issue
by using

dialog --yesno Ohno 0 0

resizing the window and then pressing <tab> to switch from the yes- to the 
no-button.

The attached patch fixes the issue by disabling the dlg_win_resize timeout 
again before
returning from this function.

-- System Information:
Debian Release: 10.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/24 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dialog depends on:
ii  debianutils   4.8.6.1
ii  libc6         2.28-10
ii  libncursesw6  6.1+20181013-2+deb10u2
ii  libtinfo6     6.1+20181013-2+deb10u2

dialog recommends no packages.

dialog suggests no packages.

-- no debconf information
diff --git a/util.c b/util.c
index 64b67d9..6fa917e 100644
--- a/util.c
+++ b/util.c
@@ -2234,6 +2234,7 @@ dlg_will_resize(WINDOW *win)
 	    }
 	}
     }
+    wtimeout(win, -1);
     dlg_trace_msg("# caught %d KEY_RESIZE key%s\n",
 		  1 + caught,
 		  caught == 1 ? "" : "s");

Reply via email to