unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
@ 2012-07-09 12:12 Vincent Lefevre
  2012-07-09 14:29 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Vincent Lefevre @ 2012-07-09 12:12 UTC (permalink / raw)
  To: 11886

A Ctrl-G in an Emacs 24.1 running in a terminal sends a SIGINT to
the parent shell. This can be seen with dash, mksh and posh under
Debian. For instance:

$ dash -c "/usr/local/emacs-24.1/bin/emacs -Q -nw"

$ echo $?
130

Emacs 23 didn't have such a problem.


In GNU Emacs 24.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2012-06-19 on xvii
Configured using:
 `configure '--prefix=/usr/local/emacs-24.1' '--enable-asserts''

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

Major mode: Lisp Interaction

Minor modes in effect:
  display-time-mode: t
  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
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 0 ; 2 7 8 ; 0 c ESC ] 1 1 ; r g b : 0 0 0 0 
/ 0 0 0 0 / 0 0 0 0 ESC \ ESC x r e p o r t - b u g 
RET

Recent messages:
("/usr/local/emacs-24.1/bin/emacs")
Loading /home/vinc17/share/emacs/site-lisp/mutteditor.el (source)...done
Loading time...done
For information about GNU Emacs and the GNU system, type C-h C-a.
goto-history-element: Beginning of history; no preceding item

Load-path shadows:
~/share/emacs/site-lisp/sh-script hides /usr/local/emacs-24.1/share/emacs/24.1/lisp/progmodes/sh-script

Features:
(shadow sort gnus-util mail-extr warnings emacsbug message format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils time cus-start cus-load
time-date paren cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt
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)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 12:12 bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell Vincent Lefevre
@ 2012-07-09 14:29 ` Andreas Schwab
  2012-07-09 16:08   ` Vincent Lefevre
  2012-07-09 15:22 ` Andreas Schwab
  2012-11-26 22:36 ` Paul Eggert
  2 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2012-07-09 14:29 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 11886

Vincent Lefevre <vincent@vinc17.net> writes:

> This can be seen with dash, mksh and posh under Debian. For instance:
>
> $ dash -c "/usr/local/emacs-24.1/bin/emacs -Q -nw"

What happens when you run gdb like this and type C-c?

Andreas.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 12:12 bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell Vincent Lefevre
  2012-07-09 14:29 ` Andreas Schwab
@ 2012-07-09 15:22 ` Andreas Schwab
  2012-11-26 22:36 ` Paul Eggert
  2 siblings, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2012-07-09 15:22 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: dann, 11886

BSD_PGRPS has been removed from s/gnu-linux.h in
<http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=75ef3f2c409f78cb38a8000d19d47606119a2f3c>
but without a change log.  Subsequently
<http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=98c3b86eab81a5dee5e2a292bbc8d385226e59b2>
removed BSD_PGRPS altogether.

Andreas.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 14:29 ` Andreas Schwab
@ 2012-07-09 16:08   ` Vincent Lefevre
  2012-07-09 16:41     ` Andreas Schwab
  2012-07-09 16:51     ` Andreas Schwab
  0 siblings, 2 replies; 12+ messages in thread
From: Vincent Lefevre @ 2012-07-09 16:08 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 11886

On 2012-07-09 16:29:35 +0200, Andreas Schwab wrote:
> Vincent Lefevre <vincent@vinc17.net> writes:
> 
> > This can be seen with dash, mksh and posh under Debian. For instance:
> >
> > $ dash -c "/usr/local/emacs-24.1/bin/emacs -Q -nw"
> 
> What happens when you run gdb like this and type C-c?

Exactly the same thing and differences between shells. I assume that
like Ctrl-G in Emacs, a Ctrl-C in gdb is intended to be just for gdb,
not for the parent processes, contrary to something like

  some_shell -c "sleep 3"; echo foo

where Ctrl-C is typed during the "sleep 3" (as expected, "foo" is
never output).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 16:08   ` Vincent Lefevre
@ 2012-07-09 16:41     ` Andreas Schwab
  2012-07-10  0:01       ` Vincent Lefevre
  2012-07-09 16:51     ` Andreas Schwab
  1 sibling, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2012-07-09 16:41 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 11886

Vincent Lefevre <vincent@vinc17.net> writes:

> On 2012-07-09 16:29:35 +0200, Andreas Schwab wrote:
>> Vincent Lefevre <vincent@vinc17.net> writes:
>> 
>> > This can be seen with dash, mksh and posh under Debian. For instance:
>> >
>> > $ dash -c "/usr/local/emacs-24.1/bin/emacs -Q -nw"
>> 
>> What happens when you run gdb like this and type C-c?
>
> Exactly the same thing and differences between shells.

I think this is a bug in the shell.  It should ignore SIGINT and SIGQUIT
while executing the command.

Andreas.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 16:08   ` Vincent Lefevre
  2012-07-09 16:41     ` Andreas Schwab
@ 2012-07-09 16:51     ` Andreas Schwab
  2012-07-10  0:18       ` Vincent Lefevre
  1 sibling, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2012-07-09 16:51 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 11886

You will probably get the same behaviour with any other interactive
command.  Emacs was unusual in that it put itself in its own process
group.

Andreas.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 16:41     ` Andreas Schwab
@ 2012-07-10  0:01       ` Vincent Lefevre
  0 siblings, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 2012-07-10  0:01 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 11886

On 2012-07-09 18:41:40 +0200, Andreas Schwab wrote:
> Vincent Lefevre <vincent@vinc17.net> writes:
> 
> > On 2012-07-09 16:29:35 +0200, Andreas Schwab wrote:
> >> Vincent Lefevre <vincent@vinc17.net> writes:
> >> 
> >> > This can be seen with dash, mksh and posh under Debian. For instance:
> >> >
> >> > $ dash -c "/usr/local/emacs-24.1/bin/emacs -Q -nw"
> >> 
> >> What happens when you run gdb like this and type C-c?
> >
> > Exactly the same thing and differences between shells.
> 
> I think this is a bug in the shell.  It should ignore SIGINT and SIGQUIT
> while executing the command.

I can report a bug against these shells, but how does a shell make
a difference between

  some_shell -c "/bin/sleep 3"

(on which SIGINT isn't ignored) and

  some_shell -c "emacs ..."

(on which it should ignore SIGINT)?

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 16:51     ` Andreas Schwab
@ 2012-07-10  0:18       ` Vincent Lefevre
  2012-07-10  6:52         ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Vincent Lefevre @ 2012-07-10  0:18 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 11886

On 2012-07-09 18:51:12 +0200, Andreas Schwab wrote:
> You will probably get the same behaviour with any other interactive
> command.  Emacs was unusual in that it put itself in its own process
> group.

No, a Ctrl-C in

  zsh -c "info Emacs"; echo foo

interrupts info though it is interactive, contrary to what happens
with gdb and Emacs. It seems that the condition is that the command
traps the signal. One even has:

ypig:~> cat trap.sh
#!/bin/bash

trap 'kill -INT $$' INT
sleep 3
ypig:~> zsh -c trap.sh; echo foo
^Czsh: exit 130   zsh -c trap.sh
foo

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-10  0:18       ` Vincent Lefevre
@ 2012-07-10  6:52         ` Andreas Schwab
  2012-08-07 14:05           ` Vincent Lefevre
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2012-07-10  6:52 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 11886

Vincent Lefevre <vincent@vinc17.net> writes:

> It seems that the condition is that the command traps the signal.

Of course.  A command that exits on C-c exits on C-c.

Andreas.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-10  6:52         ` Andreas Schwab
@ 2012-08-07 14:05           ` Vincent Lefevre
  2012-08-07 17:42             ` Vincent Lefevre
  0 siblings, 1 reply; 12+ messages in thread
From: Vincent Lefevre @ 2012-08-07 14:05 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 11886

I've reported the problem in the Debian BTS for dash:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683671

Now I remember that the problem is described on:

  http://www.cons.org/cracauer/sigint.html

And contrary to what I've said, zsh is also buggy, but only in the
case where the command is *not* the last one (I suppose that this
difference is because zsh does an exec for the last command, when
possible).

On 2012-07-10 08:52:38 +0200, Andreas Schwab wrote:
> Vincent Lefevre <vincent@vinc17.net> writes:
> 
> > It seems that the condition is that the command traps the signal.
> 
> Of course.  A command that exits on C-c exits on C-c.

Actually, no. This was my test that was buggy:

ypig:~> cat trap.sh
#!/bin/bash

trap 'kill -INT $$' INT
sleep 3
ypig:~> zsh -c trap.sh; echo foo
^Czsh: exit 130   zsh -c trap.sh
foo

A correct test, with

  trap 'trap - INT; kill -INT $$' INT

shows that "foo" is not output, as expected.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-08-07 14:05           ` Vincent Lefevre
@ 2012-08-07 17:42             ` Vincent Lefevre
  0 siblings, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 2012-08-07 17:42 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 11886

On 2012-08-07 16:05:07 +0200, Vincent Lefevre wrote:
> I've reported the problem in the Debian BTS for dash:
> 
>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683671

I think that there is a bug in Emacs too, because I also get
problems when the parent shell is bash or ksh. Under X, with

  bash -c 'emacs24 & emacs24 -nw; wait'

typing Ctrl-G in the terminal kills the Emacs that has its own
interface.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell
  2012-07-09 12:12 bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell Vincent Lefevre
  2012-07-09 14:29 ` Andreas Schwab
  2012-07-09 15:22 ` Andreas Schwab
@ 2012-11-26 22:36 ` Paul Eggert
  2 siblings, 0 replies; 12+ messages in thread
From: Paul Eggert @ 2012-11-26 22:36 UTC (permalink / raw)
  To: 11886-done

This bug seems to have been fixed in the Emacs trunk,
I assume as part of some signal-handling changes,
so I'm taking the liberty of marking it as done.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-11-26 22:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-09 12:12 bug#11886: 24.1; Ctrl-G in an emacs running in a terminal sends a SIGINT to the parent shell Vincent Lefevre
2012-07-09 14:29 ` Andreas Schwab
2012-07-09 16:08   ` Vincent Lefevre
2012-07-09 16:41     ` Andreas Schwab
2012-07-10  0:01       ` Vincent Lefevre
2012-07-09 16:51     ` Andreas Schwab
2012-07-10  0:18       ` Vincent Lefevre
2012-07-10  6:52         ` Andreas Schwab
2012-08-07 14:05           ` Vincent Lefevre
2012-08-07 17:42             ` Vincent Lefevre
2012-07-09 15:22 ` Andreas Schwab
2012-11-26 22:36 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).