On Sun, 30 Nov 2008, Thomas Viehmann wrote:
tags 506717 + patch pending
severity 506717 serious
thanks
Hi everyone,
actually, ncurses-using applications (e.g. aptitude) will crash without
this patch. As such this should be fixed in testing.
Attached is a proposed t-p-u upload.
...
diff -u ncurses-5.6+20080830/debian/patches/00list
ncurses-5.6+20080830/debian/patches/00list
...
+--- a/ncurses/base/lib_mouse.c 2008-11-24 00:29:19.000000000 +0100
++++ b/ncurses/base/lib_mouse.c 2008-11-24 00:31:12.000000000 +0100
+@@ -651,7 +651,15 @@
+ /* query server for event, return TRUE if we find one */
+ Gpm_Event ev;
+
+- if (my_Gpm_GetEvent(&ev) == 1) {
++ if (sp->_mouse_fd == -1)
rather than a break _here_, making it like _this_ seems better:
if (sp->_mouse_fd >= 0) {
... and leaving the break after the chunk that's protected.
++ break;
++
++ switch (my_Gpm_GetEvent(&ev)) {
but this can return -1, 0 or 1.
(even if we don't want to close the connection, we probably want to
ignore the resulting data on a -1).
++ case 0:
++ /* Connection closed, drop the mouse. */
++ sp->_mouse_fd = -1;
++ break;
++ case 1:
+ /* there's only one mouse... */
+ eventp->id = NORMAL_EVENT;
+
+@@ -684,6 +692,7 @@
+ /* bump the next-free pointer into the circular list */
+ sp->_mouse_eventp = eventp = NEXT(eventp);
+ result = TRUE;
++ break;
+ }
+ }
+ break;
with that, the diff would look something like
--- lib_mouse.c.orig 2008-11-22 19:11:46.000000000 -0500
+++ lib_mouse.c 2008-11-29 20:37:27.000000000 -0500
@@ -694,11 +694,16 @@
#if USE_GPM_SUPPORT
case M_GPM:
- {
+ if (sp->_mouse_fd >= 0) {
/* query server for event, return TRUE if we find one */
Gpm_Event ev;
- if (my_Gpm_GetEvent(&ev) == 1) {
+ switch (my_Gpm_GetEvent(&ev)) {
+ case 0:
+ /* Connection closed, drop the mouse. */
+ sp->_mouse_fd = -1;
+ break;
+ case 1:
/* there's only one mouse... */
eventp->id = NORMAL_EVENT;
@@ -731,6 +736,7 @@
/* bump the next-free pointer into the circular list */
sp->_mouse_eventp = eventp = NEXT(eventp);
result = TRUE;
+ break;
}
}
break;
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]