From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#7225: 23.2.50; [PATCH] C-c C-c doesn't work in shell mode (Cygwin) Date: Sun, 17 Oct 2010 17:40:39 -0400 Message-ID: <4CBB6D57.3040108@cornell.edu> References: <4CB8E584.1090800@cornell.edu> <83iq12bnjj.fsf@gnu.org> <4CB99E2C.5030904@cornell.edu> <838w1yb757.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1287351761 2212 80.91.229.12 (17 Oct 2010 21:42:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Oct 2010 21:42:41 +0000 (UTC) Cc: "7225@debbugs.gnu.org" <7225@debbugs.gnu.org> To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 17 23:42:38 2010 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.69) (envelope-from ) id 1P7b01-0005qK-R6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Oct 2010 23:42:38 +0200 Original-Received: from localhost ([127.0.0.1]:38958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7b00-0007yf-PO for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Oct 2010 17:42:36 -0400 Original-Received: from [140.186.70.92] (port=52952 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7azt-0007yZ-6m for bug-gnu-emacs@gnu.org; Sun, 17 Oct 2010 17:42:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7azr-0000I8-V6 for bug-gnu-emacs@gnu.org; Sun, 17 Oct 2010 17:42:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7azr-0000I3-Sp for bug-gnu-emacs@gnu.org; Sun, 17 Oct 2010 17:42:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P7avZ-0007jD-JS; Sun, 17 Oct 2010 17:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Oct 2010 21:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7225 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 7225-submit@debbugs.gnu.org id=B7225.128735142929700 (code B ref 7225); Sun, 17 Oct 2010 21:38:01 +0000 Original-Received: (at 7225) by debbugs.gnu.org; 17 Oct 2010 21:37:09 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7aui-0007iz-Hq for submit@debbugs.gnu.org; Sun, 17 Oct 2010 17:37:08 -0400 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141] helo=authusersmtp.mail.cornell.edu) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7aug-0007id-2F for 7225@debbugs.gnu.org; Sun, 17 Oct 2010 17:37:06 -0400 Original-Received: from [127.0.0.1] (cpe-67-249-196-94.twcny.res.rr.com [67.249.196.94]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id o9HLekvh003950; Sun, 17 Oct 2010 17:40:47 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 In-Reply-To: <838w1yb757.fsf@gnu.org> X-Antivirus: avast! (VPS 101017-1, 10/17/2010), Outbound message X-Antivirus-Status: Clean X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 17 Oct 2010 17:38:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org 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:40935 Archived-At: On 10/16/2010 9:26 AM, Eli Zaretskii wrote: >> Date: Sat, 16 Oct 2010 08:44:28 -0400 >> From: Ken Brown >> CC: "7225@debbugs.gnu.org"<7225@debbugs.gnu.org> >> >>>> C-c C-c >>>> (The cat process doesn't get killed.) >>> >>> Is the reason for this known? It looks like the `kill' syscall isn't >>> doing its job, but if that's so, there should be a good reason for >>> that. >> >> The problem is the group id in the call to 'kill'. Cygwin doesn't >> define TIOCGPGRP, and the group id as set in line 6233 of process.c >> (emacs-23 branch) is the wrong group id. > > Does Cygwin have another way of getting the process group ID? If so, > can it be used in process_send_signal instead of emacs_get_tty_pgrp? [...] > So I suggest to look into tweaking process_send_signal so that it > works with Cygwin. It looks like it makes all kinds of assumptions > regarding systems that don't have TIOCGPGRP, and they are probably > wrong for Cyugwin. Or maybe you need something special in > EMACS_KILLPG. > > When you have fixed process_send_signal, you can then introduce > SIGNALS_VIA_CHARACTERS for Cygwin. I haven't yet found an alternative to TIOCGPGRP that works for Cygwin, and it may well be that there isn't one. But I think there's a separate issue that is not specific to Cygwin. It seems to me that line 6233 of process.c is simply wrong, and not just for Cygwin. When we reach that line, we want the process group ID of the foreground process group of the terminal associated with p (which is a shell in the most common use case). We don't have TIOCGPGRP, so we don't know how to do this. We therefore give up and set gid = p->pid. Is there any situation in which this is the right thing to do? It means that (in the common use case) we'll send the signal to the shell instead of to the process running in the shell. Wouldn't it be better to just return at that point and issue a warning message saying that we can't send the signal? What this would mean for Cygwin, once I make the change I proposed (and assuming I don't find a better solution), is that the only signals we'll be able to send to the foreground process of a shell are SIGINT, SIGQUIT, and SIGTSTP, and we'll see a failure message if we try to send a different signal. That's better than sending a signal to the wrong process.