unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
@ 2010-07-16  7:08 enami tsugutomo
  2010-07-24  5:20 ` Dan Nicolaescu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: enami tsugutomo @ 2010-07-16  7:08 UTC (permalink / raw)
  To: 6649

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@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@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@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)






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

* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
  2010-07-16  7:08 bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD enami tsugutomo
@ 2010-07-24  5:20 ` Dan Nicolaescu
  2010-07-30  0:39   ` enami tsugutomo
  2010-07-24  7:18 ` Andreas Schwab
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Dan Nicolaescu @ 2010-07-24  5:20 UTC (permalink / raw)
  To: enami tsugutomo; +Cc: 6649

enami tsugutomo <tsugutomo.enami@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@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@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@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.





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

* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
  2010-07-16  7:08 bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD enami tsugutomo
  2010-07-24  5:20 ` Dan Nicolaescu
@ 2010-07-24  7:18 ` Andreas Schwab
  2011-10-25  4:29 ` Chong Yidong
  2011-10-25 16:41 ` Paul Eggert
  3 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2010-07-24  7:18 UTC (permalink / raw)
  To: enami tsugutomo; +Cc: 6649

enami tsugutomo <tsugutomo.enami@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@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] 7+ messages in thread

* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
  2010-07-24  5:20 ` Dan Nicolaescu
@ 2010-07-30  0:39   ` enami tsugutomo
  2010-07-30  4:55     ` Dan Nicolaescu
  0 siblings, 1 reply; 7+ messages in thread
From: enami tsugutomo @ 2010-07-30  0:39 UTC (permalink / raw)
  To: Dan Nicolaescu, Andreas Schwab; +Cc: 6649

Dan Nicolaescu <dann@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@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.





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

* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
  2010-07-30  0:39   ` enami tsugutomo
@ 2010-07-30  4:55     ` Dan Nicolaescu
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Nicolaescu @ 2010-07-30  4:55 UTC (permalink / raw)
  To: enami tsugutomo; +Cc: Andreas Schwab, 6649

enami tsugutomo <tsugutomo.enami@jp.sony.com> writes:

> Dan Nicolaescu <dann@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... 





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

* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
  2010-07-16  7:08 bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD enami tsugutomo
  2010-07-24  5:20 ` Dan Nicolaescu
  2010-07-24  7:18 ` Andreas Schwab
@ 2011-10-25  4:29 ` Chong Yidong
  2011-10-25 16:41 ` Paul Eggert
  3 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2011-10-25  4:29 UTC (permalink / raw)
  To: 6649; +Cc: enami tsugutomo

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.





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

* bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD
  2010-07-16  7:08 bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD enami tsugutomo
                   ` (2 preceding siblings ...)
  2011-10-25  4:29 ` Chong Yidong
@ 2011-10-25 16:41 ` Paul Eggert
  3 siblings, 0 replies; 7+ messages in thread
From: Paul Eggert @ 2011-10-25 16:41 UTC (permalink / raw)
  To: 6649

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.





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

end of thread, other threads:[~2011-10-25 16:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-16  7:08 bug#6649: 24.0.50; C-g doesn't work since emacs 23.1 on BSD enami tsugutomo
2010-07-24  5:20 ` Dan Nicolaescu
2010-07-30  0:39   ` enami tsugutomo
2010-07-30  4:55     ` Dan Nicolaescu
2010-07-24  7:18 ` Andreas Schwab
2011-10-25  4:29 ` Chong Yidong
2011-10-25 16:41 ` 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).