GNU bug report logs - #6649
24.0.50; C-g doesn't work since emacs 23.1 on BSD

Previous Next

Package: emacs;

Reported by: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>

Date: Fri, 16 Jul 2010 07:09:02 UTC

Severity: important

Found in version 24.0.50

Done: Chong Yidong <cyd <at> gnu.org>

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 6649 in the body.
You can then email your comments to 6649 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Fri, 16 Jul 2010 07:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to enami tsugutomo <tsugutomo.enami <at> jp.sony.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 16 Jul 2010 07:09:02 GMT) Full text and rfc822 format available.

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

From: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: Fri, 16 Jul 2010 16:08:11 +0900 (JST)
C-g doesn't work for emacs 23.1 or newer on BSD system.  Build recent
emacs on BSD system (NetBSD in my case), invoke emacs using terminal,
switch to *scratch*, run (while t) and type C-g.  Emacs continues to
run.

Since INTERRUPT_INPUT isn't defined for BSD, cbreak mode is used to
input characters.  When multi-tty is merged, setting of INTR/QUIT
characters is conditoinalized (if (tty_out->input == stdin) ...) but the
expression is always false because FILE structure pointed by
tty_out->input is a one returned from fdopen() and it is never equal to
stdin.

Followings are terminal mode while running emacs-22.3 and 23.1
respectively:

enami <at> memory-leak% stty -f /dev/ttyp4                                   
speed 9600 baud;
lflags: -icanon -iexten -echo echoe echoke echoctl
iflags: -icrnl -ixon ignbrk
oflags: -onlcr -oxtabs
cflags: cs8 -parenb
discard dsusp   erase   intr    lnext   quit    reprint start   stop    
<undef> <undef> ^H      ^G      <undef> ^G      <undef> <undef> <undef> 
susp    werase  
<undef> <undef> 
enami <at> memory-leak% stty -f /dev/ttyp4
speed 9600 baud;
lflags: -icanon -iexten -echo echoe echoke echoctl
iflags: -icrnl -ixon ignbrk
oflags: -onlcr -oxtabs
cflags: cs8 -parenb
discard dsusp   erase   intr    lnext   quit    reprint start   stop    
<undef> <undef> ^H      <undef> <undef> <undef> <undef> <undef> <undef> 
susp    werase  
<undef> <undef> 
enami <at> memory-leak% 

For now, I'm using following workaround, but not sure if it is an
appropriate one.

=== modified file 'src/sysdep.c'
--- src/sysdep.c	2010-07-13 10:57:00 +0000
+++ src/sysdep.c	2010-07-15 00:39:59 +0000
@@ -989,6 +989,7 @@
 init_sys_modes (struct tty_display_info *tty_out)
 {
   struct emacs_tty tty;
+  Lisp_Object terminal;
 
   Vtty_erase_char = Qnil;
 
@@ -1042,7 +1043,8 @@
       tty.main.c_cflag &= ~PARENB;/* Don't check parity */
     }
 #endif
-  if (tty_out->input == stdin)
+  XSETTERMINAL(terminal, tty_out->terminal);
+  if (!NILP (Fcontrolling_tty_p (terminal)))
     {
       tty.main.c_cc[VINTR] = quit_char;	/* C-g (usually) gives SIGINT */
       /* Set up C-g for both SIGQUIT and SIGINT.




In GNU Emacs 24.0.50.4 (x86_64--netbsd)
 of 2010-07-16 on rplaca.sm.sony.co.jp
configured using `configure  'x86_64--netbsd' '--with-x=no' 'build_alias=x86_64--netbsd' 'host_alias=x86_64--netbsd' 'target_alias=x86_64--netbsd''

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: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC x r e p o r - C-b C-k t - TAB RET

Recent messages:
("src/emacs")
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 message sendmail regexp-opt rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-utils
gmm-utils mailheader emacsbug ediff-hook vc-hooks lisp-float-type
lisp-mode register page menu-bar rfn-eshadow timer 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 loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Sat, 24 Jul 2010 05:21:01 GMT) Full text and rfc822 format available.

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

From: Dan Nicolaescu <dann <at> gnu.org>
To: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>
Cc: 6649 <at> debbugs.gnu.org
Subject: Re: bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: Sat, 24 Jul 2010 01:20:06 -0400
enami tsugutomo <tsugutomo.enami <at> jp.sony.com> writes:

> C-g doesn't work for emacs 23.1 or newer on BSD system.  Build recent
> emacs on BSD system (NetBSD in my case), invoke emacs using terminal,
> switch to *scratch*, run (while t) and type C-g.  Emacs continues to
> run.
>
> Since INTERRUPT_INPUT isn't defined for BSD, cbreak mode is used to
> input characters.  When multi-tty is merged, setting of INTR/QUIT
> characters is conditoinalized (if (tty_out->input == stdin) ...) but the
> expression is always false because FILE structure pointed by
> tty_out->input is a one returned from fdopen() and it is never equal to
> stdin.
>
> Followings are terminal mode while running emacs-22.3 and 23.1
> respectively:
>
> enami <at> memory-leak% stty -f /dev/ttyp4                                   
> speed 9600 baud;
> lflags: -icanon -iexten -echo echoe echoke echoctl
> iflags: -icrnl -ixon ignbrk
> oflags: -onlcr -oxtabs
> cflags: cs8 -parenb
> discard dsusp   erase   intr    lnext   quit    reprint start   stop    
> <undef> <undef> ^H      ^G      <undef> ^G      <undef> <undef> <undef> 
> susp    werase  
> <undef> <undef> 
> enami <at> memory-leak% stty -f /dev/ttyp4
> speed 9600 baud;
> lflags: -icanon -iexten -echo echoe echoke echoctl
> iflags: -icrnl -ixon ignbrk
> oflags: -onlcr -oxtabs
> cflags: cs8 -parenb
> discard dsusp   erase   intr    lnext   quit    reprint start   stop    
> <undef> <undef> ^H      <undef> <undef> <undef> <undef> <undef> <undef> 
> susp    werase  
> <undef> <undef> 
> enami <at> memory-leak% 
>
> For now, I'm using following workaround, but not sure if it is an
> appropriate one.
>
> === modified file 'src/sysdep.c'
> --- src/sysdep.c	2010-07-13 10:57:00 +0000
> +++ src/sysdep.c	2010-07-15 00:39:59 +0000
> @@ -989,6 +989,7 @@
>  init_sys_modes (struct tty_display_info *tty_out)
>  {
>    struct emacs_tty tty;
> +  Lisp_Object terminal;
>  
>    Vtty_erase_char = Qnil;
>  
> @@ -1042,7 +1043,8 @@
>        tty.main.c_cflag &= ~PARENB;/* Don't check parity */
>      }
>  #endif
> -  if (tty_out->input == stdin)
> +  XSETTERMINAL(terminal, tty_out->terminal);
> +  if (!NILP (Fcontrolling_tty_p (terminal)))

You are right, it looks like  "if (tty_out->input == stdin)" can never be true.
But your proposed change would make that code active.  
In theory your proposed change sounds like a good idea, but is it?
It would be good to have someone that knows this code say yes/no to the change...

It's interesting that other platforms that do not use INTERRUPT_INPUT
like Solaris still work.  It would be interesting to know why.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Sat, 24 Jul 2010 07:20:03 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>
Cc: 6649 <at> debbugs.gnu.org
Subject: Re: bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: Sat, 24 Jul 2010 09:18:59 +0200
enami tsugutomo <tsugutomo.enami <at> jp.sony.com> writes:

> @@ -1042,7 +1043,8 @@
>        tty.main.c_cflag &= ~PARENB;/* Don't check parity */
>      }
>  #endif
> -  if (tty_out->input == stdin)
> +  XSETTERMINAL(terminal, tty_out->terminal);
> +  if (!NILP (Fcontrolling_tty_p (terminal)))

Perhaps it should just test fileno (tty_out->input) == 0 instead?

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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Fri, 30 Jul 2010 00:40:04 GMT) Full text and rfc822 format available.

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

From: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>
To: Dan Nicolaescu <dann <at> gnu.org>, Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 6649 <at> debbugs.gnu.org
Subject: Re: bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: 30 Jul 2010 09:39:56 +0900
Dan Nicolaescu <dann <at> gnu.org> writes:

> It's interesting that other platforms that do not use INTERRUPT_INPUT
> like Solaris still work.  It would be interesting to know why.

I'm also interesting to know the behavior on other systems.

Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Perhaps it should just test fileno (tty_out->input) == 0 instead?

That won't work.  From the ktrace output, it is 3 on my system.

 27179      1 emacs    CALL  open(0x81675f2,0x8002,0)
 27179      1 emacs    NAMI  "/dev/tty"
 27179      1 emacs    RET   open 3

enami.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Fri, 30 Jul 2010 04:56:01 GMT) Full text and rfc822 format available.

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

From: Dan Nicolaescu <dann <at> gnu.org>
To: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>
Cc: Andreas Schwab <schwab <at> linux-m68k.org>, 6649 <at> debbugs.gnu.org
Subject: Re: bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: Fri, 30 Jul 2010 00:55:19 -0400
enami tsugutomo <tsugutomo.enami <at> jp.sony.com> writes:

> Dan Nicolaescu <dann <at> gnu.org> writes:
>
>> It's interesting that other platforms that do not use INTERRUPT_INPUT
>> like Solaris still work.  It would be interesting to know why.
>
> I'm also interesting to know the behavior on other systems.

If you are interested, I can send you the system call trace on
Solaris, if you want to study why it works... 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Tue, 25 Oct 2011 04:32:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: 6649 <at> debbugs.gnu.org
Cc: enami tsugutomo <tsugutomo.enami <at> jp.sony.com>
Subject: Re: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: Tue, 25 Oct 2011 12:29:23 +0800
Since no one seems to have anything more to add, and the patch looks
reasonable, I've gone ahead and committed it to the trunk.




bug closed, send any further explanations to 6649 <at> debbugs.gnu.org and enami tsugutomo <tsugutomo.enami <at> jp.sony.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 25 Oct 2011 04:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6649; Package emacs. (Tue, 25 Oct 2011 16:44:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 6649 <at> debbugs.gnu.org
Subject: Re: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
Date: Tue, 25 Oct 2011 09:41:32 -0700
The patch was missing a declaration for an extern Lisp_Object
function, which is required on many platforms, so I added that
to the trunk as bzr 106188.




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

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

Previous Next


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