GNU bug report logs - #12697
24.2; Emacs crashes when using it as the commit editor for git

Previous Next

Package: emacs;

Reported by: Matthew Leach <matthew <at> mattleach.net>

Date: Mon, 22 Oct 2012 01:57:02 UTC

Severity: important

Tags: patch

Found in version 24.2

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12697 in the body.
You can then email your comments to 12697 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Mon, 22 Oct 2012 01:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthew Leach <matthew <at> mattleach.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 22 Oct 2012 01:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2; Emacs crashes when using it as the commit editor for git
Date: Sun, 21 Oct 2012 21:17:50 +0100
When I use Emacs as the editor for commit messages in git, by way of
setting the EDITOR environment variable, i.e. "export EDITOR='emacs -nw
'" in my .bashrc, if I press C-g when Emacs opens this causes Emacs to
crash and not shut down correctly as the console is not reset properly
and text from the buffer remains on the screen when I am returned to a
terminal prompt.

I am using git version 1.7.12.4


In GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.4)
 of 2012-08-28 on shaun
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu> 
<send-emacs-bug-report>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message idna format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils edmacro kmacro
tango-dark-theme paren ido time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Mon, 22 Oct 2012 08:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: 12697 <at> debbugs.gnu.org
Subject: Re: bug#12697: 24.2;
	Emacs crashes when using it as the commit editor for git
Date: Mon, 22 Oct 2012 10:26:35 +0200
Matthew Leach <matthew <at> mattleach.net> writes:

> When I use Emacs as the editor for commit messages in git, by way of
> setting the EDITOR environment variable, i.e. "export EDITOR='emacs -nw
> '" in my .bashrc, if I press C-g when Emacs opens this causes Emacs to

C-g in emacs -nw is equivalent to SIGINT on the controlling terminal.
This causes all processes in the same process group to receive SIGINT,
which includes the parent git process, now that emacs no longer puts
itself and the terminal into its own process group.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Mon, 22 Oct 2012 17:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: matthew <at> mattleach.net, 12697 <at> debbugs.gnu.org
Subject: Re: bug#12697: 24.2;
	Emacs crashes when using it as the commit editor for git
Date: Mon, 22 Oct 2012 19:15:19 +0200
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Date: Mon, 22 Oct 2012 10:26:35 +0200
> Cc: 12697 <at> debbugs.gnu.org
> 
> C-g in emacs -nw is equivalent to SIGINT on the controlling terminal.
> This causes all processes in the same process group to receive SIGINT,
> which includes the parent git process

Shouldn't git block SIGINT when it invokes $EDITOR?

> now that emacs no longer puts itself and the terminal into its own
> process group.

Did we have good reason to stop doing that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Mon, 22 Oct 2012 17:42:02 GMT) Full text and rfc822 format available.

Message #14 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: matthew <at> mattleach.net, 12697 <at> debbugs.gnu.org
Subject: Re: bug#12697: 24.2;
	Emacs crashes when using it as the commit editor for git
Date: Mon, 22 Oct 2012 19:39:55 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> C-g in emacs -nw is equivalent to SIGINT on the controlling terminal.
>> This causes all processes in the same process group to receive SIGINT,
>> which includes the parent git process
>
> Shouldn't git block SIGINT when it invokes $EDITOR?

Maybe.  Perhaps the OP should report it to the git list.

>> now that emacs no longer puts itself and the terminal into its own
>> process group.
>
> Did we have good reason to stop doing that?

IMHO no.  All the BSD_PGRPS stuff was removed on the premise that it
wasn't used any more, but disabling BSD_PGRPS in s/gnu-linux.h was
already questionable.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Mon, 22 Oct 2012 20:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: matthew <at> mattleach.net, 12697 <at> debbugs.gnu.org
Subject: Re: bug#12697: 24.2;
	Emacs crashes when using it as the commit editor for git
Date: Mon, 22 Oct 2012 22:22:55 +0200
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Cc: matthew <at> mattleach.net,  12697 <at> debbugs.gnu.org
> Date: Mon, 22 Oct 2012 19:39:55 +0200
> 
> >> now that emacs no longer puts itself and the terminal into its own
> >> process group.
> >
> > Did we have good reason to stop doing that?
> 
> IMHO no.  All the BSD_PGRPS stuff was removed on the premise that it
> wasn't used any more, but disabling BSD_PGRPS in s/gnu-linux.h was
> already questionable.

Come think about it, why not stop depending on SIGINT for quitting?
We already do that in GUI session (AFAIU), so why should TTY frames be
different?  We could just detect C-g in the SIGIO handler, no?

If this makes sense, then this whole issue would go away.  Of course,
we will then lose the "emergency exit" feature, but since core dumps
are reportedly disabled on many systems anyway, that doesn't sound
like too much of a loss, and GUI sessions already cannot use it
anyway.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Mon, 22 Oct 2012 21:37:02 GMT) Full text and rfc822 format available.

Message #20 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: matthew <at> mattleach.net, 12697 <at> debbugs.gnu.org
Subject: Re: bug#12697: 24.2;
	Emacs crashes when using it as the commit editor for git
Date: Mon, 22 Oct 2012 23:34:13 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> We could just detect C-g in the SIGIO handler, no?

That works already (just disable ISIG in init_sys_modes to try and see).

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Sat, 27 Oct 2012 05:34:02 GMT) Full text and rfc822 format available.

Message #23 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 12697 <at> debbugs.gnu.org
Cc: Matthew Leach <matthew <at> mattleach.net>, Eli Zaretskii <eliz <at> gnu.org>,
	Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re: Emacs crashes when using it as the commit editor for git
Date: Fri, 26 Oct 2012 22:31:21 -0700
[Message part 1 (text/plain, inline)]
I tried Andreas's suggestion of disabling ISIG, but
this didn't work on Solaris, and it doesn't look like
it'd work on any host where USABLE_SIGIO is false.

Instead, how about the attached patch?  It reenables
the BSD_PGRPS idea, although reimplemented, as the old
code can't easily be resurrected as-is.  I haven't
thought about how this affects the Windows port, so
I'll CC: this to Eli.
[git-commit.txt (text/plain, attachment)]

Added tag(s) patch. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Sat, 27 Oct 2012 05:38:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Sat, 27 Oct 2012 07:55:02 GMT) Full text and rfc822 format available.

Message #28 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: matthew <at> mattleach.net, 12697 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: Emacs crashes when using it as the commit editor for git
Date: Sat, 27 Oct 2012 09:52:11 +0200
> Date: Fri, 26 Oct 2012 22:31:21 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: Andreas Schwab <schwab <at> linux-m68k.org>, Eli Zaretskii <eliz <at> gnu.org>, 
>  Matthew Leach <matthew <at> mattleach.net>
> 
> Instead, how about the attached patch?  It reenables
> the BSD_PGRPS idea, although reimplemented, as the old
> code can't easily be resurrected as-is.  I haven't
> thought about how this affects the Windows port

The termios-related stuff (the call to tcsetgrp) in sysdep.c should be
#ifedf'ed away for Windows (for DOS_NT, actually).  Also, the
references to SIGTTOU should be conditioned on that signal being
defined.

Other than that, this should be OK, I think, since, if setpgid is not
available, it is redirected to setpgrp, which already has a no-op
implementation for Windows.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12697; Package emacs. (Sun, 28 Oct 2012 19:00:02 GMT) Full text and rfc822 format available.

Message #31 received at 12697 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: matthew <at> mattleach.net, 12697 <at> debbugs.gnu.org, schwab <at> linux-m68k.org
Subject: Re: Emacs crashes when using it as the commit editor for git
Date: Sun, 28 Oct 2012 11:57:16 -0700
[Message part 1 (text/plain, inline)]
On 10/27/2012 12:52 AM, Eli Zaretskii wrote:

> The termios-related stuff (the call to tcsetgrp) in sysdep.c should be
> #ifedf'ed away for Windows (for DOS_NT, actually).  Also, the
> references to SIGTTOU should be conditioned on that signal being
> defined.

Thanks, that problem occurs with older POSIXish systems too.
Here's a simple fix for it.  I'm attaching the resulting
combined patch, relative to trunk bzr 110706.

The bug is a relatively serious one, so I'm inclined to install
the combined patch soon.

=== modified file 'src/sysdep.c'
--- src/sysdep.c	2012-10-27 05:07:17 +0000
+++ src/sysdep.c	2012-10-28 18:39:51 +0000
@@ -716,16 +716,21 @@
 /* Safely set a controlling terminal FD's process group to PGID.
    If we are not in the foreground already, POSIX requires tcsetpgrp
    to deliver a SIGTTOU signal, which would stop us.  This is an
-   annoyance, so temporarily ignore the signal.  */
+   annoyance, so temporarily ignore the signal.
+
+   In practice, platforms lacking SIGTTOU also lack tcsetpgrp, so
+   skip all this unless SIGTTOU is defined.  */
 static void
 tcsetpgrp_without_stopping (int fd, pid_t pgid)
 {
+#ifdef SIGTTOU
   signal_handler_t handler;
   block_input ();
   handler = signal (SIGTTOU, SIG_IGN);
   tcsetpgrp (fd, pgid);
   signal (SIGTTOU, handler);
   unblock_input ();
+#endif
 }
 
 /* Split off the foreground process group to Emacs alone.  When we are


[git-commit.txt (text/plain, attachment)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 31 Oct 2012 17:32:02 GMT) Full text and rfc822 format available.

Notification sent to Matthew Leach <matthew <at> mattleach.net>:
bug acknowledged by developer. (Wed, 31 Oct 2012 17:32:03 GMT) Full text and rfc822 format available.

Message #36 received at 12697-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 12697-done <at> debbugs.gnu.org
Subject: Re: Emacs crashes when using it as the commit editor for git
Date: Wed, 31 Oct 2012 10:28:59 -0700
I installed the patch into the trunk as bzr 110750
and am marking this as done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.