From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#407: gpm server stop making emacs abort() Date: Fri, 31 Oct 2008 09:11:07 +1100 Message-ID: <87ej1xsphg.fsf@blah.blah> References: <87wsktf41m.fsf@blah.blah> <87iqvpgwsj.fsf@gmx.de> <87vdx1oqnz.fsf@gmx.de> Reply-To: Kevin Ryde , 407@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1225405830 20279 80.91.229.12 (30 Oct 2008 22:30:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Oct 2008 22:30:30 +0000 (UTC) To: 407@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 30 23:31:31 2008 connect(): Connection refused Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kvg39-00074T-1x for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Oct 2008 23:31:31 +0100 Original-Received: from localhost ([127.0.0.1]:44612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kvg21-0007br-M8 for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Oct 2008 18:30:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kvg1y-0007bm-FV for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 18:30:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kvg1v-0007bO-K9 for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 18:30:18 -0400 Original-Received: from [199.232.76.173] (port=59528 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kvg1v-0007bL-EY for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 18:30:15 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43843) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kvg1u-000271-1m for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 18:30:15 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9UMU4bv029811; Thu, 30 Oct 2008 15:30:04 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m9UMK2tG027272; Thu, 30 Oct 2008 15:20:02 -0700 X-Loop: don@donarmstrong.com Resent-From: Kevin Ryde Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 30 Oct 2008 22:20:02 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 407 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: moreinfo Original-Received: via spool by 407-submit@emacsbugs.donarmstrong.com id=B407.122540472126001 (code B ref 407); Thu, 30 Oct 2008 22:20:02 +0000 Original-Received: (at 407) by emacsbugs.donarmstrong.com; 30 Oct 2008 22:12:01 +0000 Original-Received: from mailout2.pacific.net.au (mailout2-5.pacific.net.au [61.8.2.228]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9UMBuSQ025995 for <407@emacsbugs.donarmstrong.com>; Thu, 30 Oct 2008 15:11:58 -0700 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id BC2A1F9705; Fri, 31 Oct 2008 09:11:55 +1100 (EST) Original-Received: from blah.blah (ppp2E76.dyn.pacific.net.au [61.8.46.118]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id AF05527407; Fri, 31 Oct 2008 09:11:49 +1100 (EST) Original-Received: from gg by blah.blah with local (Exim 4.69) (envelope-from ) id 1KvfjP-00034y-NM; Fri, 31 Oct 2008 09:11:07 +1100 User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 30 Oct 2008 18:30:18 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:22050 Archived-At: --=-=-= Stefan Monnier writes: > > Huh! Indeed! The condition "gpm < 0" is encountered all the time, Yes, EWOULDBLOCK. gpm==0 is eof from the server. gpm==-1 is a protocol error as well as EWOULDBLOCK, but it might be ok to quietly ignore that. It probably only happens if libgpm.so and the running daemon are incompatible versions. I get some joy from the change below. I think the add/delete descriptor calls might be right, but I'm not terrifically confident. One thing I notice not done is to turn off the gpm-mouse-mode minor mode variable when stopping like this. Maybe that's good enough. It won't stop normally, so as long as emacs doesn't abort that could be enough. (You can M-x gpm-mouse-mode twice to toggle it back on.) --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=keyboard.c.gpm.diff *** keyboard.c 31 Oct 2008 08:25:09 +1100 1.977 --- keyboard.c 31 Oct 2008 08:25:19 +1100 *************** *** 7102,7118 **** { Gpm_Event event; struct input_event hold_quit; ! int gpm; EVENT_INIT (hold_quit); hold_quit.kind = NO_EVENT; while (gpm = Gpm_GetEvent (&event), gpm == 1) { nread += handle_one_term_event (tty, &event, &hold_quit); } ! if (gpm < 0) ! /* Presumably the GPM daemon has closed the connection. */ ! close_gpm (); if (hold_quit.kind != NO_EVENT) kbd_buffer_store_event (&hold_quit); if (nread) --- 7102,7123 ---- { Gpm_Event event; struct input_event hold_quit; ! int gpm, fd; EVENT_INIT (hold_quit); hold_quit.kind = NO_EVENT; + /* gpm==1 if event received. + gpm==0 if the GPM daemon has closed the connection, in which case + Gpm_GetEvent closes gpm_fd and clears it to -1, so save that + for close_gpm() to remove from the select masks. + gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ + fd = gpm_fd; while (gpm = Gpm_GetEvent (&event), gpm == 1) { nread += handle_one_term_event (tty, &event, &hold_quit); } ! if (gpm == 0) ! close_gpm (fd); if (hold_quit.kind != NO_EVENT) kbd_buffer_store_event (&hold_quit); if (nread) --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=term.c.gpm.diff *** term.c 31 Oct 2008 08:23:59 +1100 1.229 --- term.c 31 Oct 2008 08:24:05 +1100 *************** *** 3129,3138 **** } void ! close_gpm () { ! if (gpm_fd >= 0) ! delete_gpm_wait_descriptor (gpm_fd); while (Gpm_Close()); /* close all the stack */ gpm_tty = NULL; } --- 3129,3139 ---- } void ! close_gpm (fd) ! int fd; { ! if (fd >= 0) ! delete_gpm_wait_descriptor (fd); while (Gpm_Close()); /* close all the stack */ gpm_tty = NULL; } *************** *** 3150,3156 **** if (!tty || gpm_tty != tty) return Qnil; /* Not activated on this terminal, nothing to do. */ ! close_gpm (); return Qnil; } #endif /* HAVE_GPM */ --- 3151,3157 ---- if (!tty || gpm_tty != tty) return Qnil; /* Not activated on this terminal, nothing to do. */ ! close_gpm (gpm_fd); return Qnil; } #endif /* HAVE_GPM */ --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=termhooks.h.gpm.diff *** termhooks.h 13 Sep 2008 07:34:28 +1000 1.98 --- termhooks.h 30 Oct 2008 18:54:52 +1100 *************** *** 644,650 **** extern struct terminal *initial_terminal; #ifdef HAVE_GPM ! extern void close_gpm (void); #endif /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d --- 644,650 ---- extern struct terminal *initial_terminal; #ifdef HAVE_GPM ! extern void close_gpm P_ ((int)); #endif /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d --=-=-= -- The sigfile one-line movie review series: "Cold Fever" -- easily the best Japanese-Icelandic road movie ever made. --=-=-=--