unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
@ 2012-03-06 15:01 Vincent Lefevre
  2012-03-22 11:19 ` Vincent Lefevre
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Vincent Lefevre @ 2012-03-06 15:01 UTC (permalink / raw)
  To: 10959

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your report will be posted to the bug-gnu-emacs@gnu.org mailing list
and the gnu.emacs.bug news group, and at http://debbugs.gnu.org.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':

When run in a terminal (at least in xterm, aterm and gnome-terminal),
emacs doesn't always restore the terminal screen (it remains in the
alternate screen). This can be reproduced, but not always, with:

  for i in `seq 1 200`
  do
    emacs -Q -nw --eval '(save-buffers-kill-terminal)'
  done

One sees that the screen isn't restored as expected. You can increase
the number of iterations to have a better chance to reproduce the bug.

I couldn't reproduce this bug in rxvt-unicode.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/local/emacs-23.3b/share/emacs/23.3/etc/DEBUG.


In GNU Emacs 23.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.8)
 of 2011-12-15 on xvii
configured using `configure  '--prefix=/usr/local/emacs-23.3b' '--enable-asserts' '--with-crt-dir=/usr/lib/x86_64-linux-gnu''

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-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 6 ; 0 c ESC ] 1 1 ; r g b : 0 0 0 0 
/ 0 0 0 0 / 0 0 0 0 ESC \ C-h C-p C-s a l t e r n a 
C-s C-r C-r C-s C-s C-s C-s ESC O H C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s ESC O H C-s t e 
r m i n a l C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s ESC O H C-s s s 
h C-s C-s C-s C-s C-s C-s C-s C-s ESC O B ESC [ 6 ~ 
ESC [ 6 ~ ESC [ 6 ~ ESC [ 6 ~ q ESC x r e p o TAB r 
t TAB RET

Recent messages:
Note: file is write protected
View mode: type C-h for help, h for commands, q to quit.
Mark saved where search started
Mark set
Mark saved where search started
Mark set
Mark saved where search started
Mark set
Mark saved where search started
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1
hex-util hashcash mail-utils warnings emacsbug help-mode easymenu
multi-isearch goto-addr thingatpt noutline outline easy-mmode view time
cus-start cus-load 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 font-setting tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mldrag 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 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 dbusbind system-font-setting
font-render-setting gtk x-toolkit x multi-tty emacs)





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

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-03-06 15:01 bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen Vincent Lefevre
@ 2012-03-22 11:19 ` Vincent Lefevre
  2012-06-15 14:21   ` Vincent Lefevre
  2012-03-22 11:25 ` Vincent Lefevre
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Vincent Lefevre @ 2012-03-22 11:19 UTC (permalink / raw)
  To: 10959

On 2012-03-06 16:01:04 +0100, Vincent Lefevre wrote:
> When run in a terminal (at least in xterm, aterm and gnome-terminal),
> emacs doesn't always restore the terminal screen (it remains in the
> alternate screen). This can be reproduced, but not always, with:
> 
>   for i in `seq 1 200`
>   do
>     emacs -Q -nw --eval '(save-buffers-kill-terminal)'
>   done
> 
> One sees that the screen isn't restored as expected. You can increase
> the number of iterations to have a better chance to reproduce the bug.
[...]

This problem still occurs with GNU Emacs 23.4.1 from the Debian
package emacs23 23.4+1-2 (tested in xterm).

-- 
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] 10+ messages in thread

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-03-06 15:01 bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen Vincent Lefevre
  2012-03-22 11:19 ` Vincent Lefevre
@ 2012-03-22 11:25 ` Vincent Lefevre
  2012-03-22 15:38 ` Stefan Monnier
  2015-10-09 12:59 ` Vincent Lefevre
  3 siblings, 0 replies; 10+ messages in thread
From: Vincent Lefevre @ 2012-03-22 11:25 UTC (permalink / raw)
  To: 10959

On 2012-03-06 16:01:04 +0100, Vincent Lefevre wrote:
> When run in a terminal (at least in xterm, aterm and gnome-terminal),
> emacs doesn't always restore the terminal screen (it remains in the
> alternate screen). This can be reproduced, but not always, with:
> 
>   for i in `seq 1 200`
>   do
>     emacs -Q -nw --eval '(save-buffers-kill-terminal)'
>   done
> 
> One sees that the screen isn't restored as expected. You can increase
> the number of iterations to have a better chance to reproduce the bug.

This bug might be a consequence of

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

but I don't know how to test...

-- 
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] 10+ messages in thread

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-03-06 15:01 bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen Vincent Lefevre
  2012-03-22 11:19 ` Vincent Lefevre
  2012-03-22 11:25 ` Vincent Lefevre
@ 2012-03-22 15:38 ` Stefan Monnier
  2015-10-09 12:59 ` Vincent Lefevre
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2012-03-22 15:38 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 10959

> When run in a terminal (at least in xterm, aterm and gnome-terminal),
> emacs doesn't always restore the terminal screen (it remains in the
> alternate screen). This can be reproduced, but not always, with:

>   for i in `seq 1 200`
>   do
>     emacs -Q -nw --eval '(save-buffers-kill-terminal)'
>   done

I can reproduce it here, indeed (also with the current Emacs-24
pretest).  Problem is: I don't know anything about such terminal
initialization, so we need someone who does to help us out,


        Stefan





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

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-03-22 11:19 ` Vincent Lefevre
@ 2012-06-15 14:21   ` Vincent Lefevre
  2012-06-16  6:26     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Vincent Lefevre @ 2012-06-15 14:21 UTC (permalink / raw)
  To: 10959

On 2012-03-22 12:19:20 +0100, Vincent Lefevre wrote:
> This problem still occurs with GNU Emacs 23.4.1 from the Debian
> package emacs23 23.4+1-2 (tested in xterm).

and it still occurs with the official GNU Emacs 24.1.1.

-- 
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] 10+ messages in thread

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-06-15 14:21   ` Vincent Lefevre
@ 2012-06-16  6:26     ` Stefan Monnier
  2012-06-16  7:41       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2012-06-16  6:26 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 10959

>> This problem still occurs with GNU Emacs 23.4.1 from the Debian
>> package emacs23 23.4+1-2 (tested in xterm).
> and it still occurs with the official GNU Emacs 24.1.1.

Thanks for checking and confirming.  I hope someone who actually know
about such terminal setup/restore will have a chance to look at it.


        Stefan





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

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-06-16  6:26     ` Stefan Monnier
@ 2012-06-16  7:41       ` Eli Zaretskii
  2012-06-16 10:00         ` Chong Yidong
  2012-06-16 16:13         ` Vincent Lefevre
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2012-06-16  7:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 10959, vincent

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Sat, 16 Jun 2012 02:26:41 -0400
> Cc: 10959@debbugs.gnu.org
> 
> >> This problem still occurs with GNU Emacs 23.4.1 from the Debian
> >> package emacs23 23.4+1-2 (tested in xterm).
> > and it still occurs with the official GNU Emacs 24.1.1.
> 
> Thanks for checking and confirming.  I hope someone who actually know
> about such terminal setup/restore will have a chance to look at it.

I know very little about this, but here's what I know: this feature
relies upon the "ti" and "te" terminal capabilities.  We use these
capabilities in tty_set_terminal_modes and tty_reset_terminal_modes,
respectively.  In both cases, we output the terminal command only if
the tty->output FILE stream is non-NULL.  So perhaps some timing
issues cause tty->output to become NULL before we get to
tty_reset_terminal_modes, or maybe it is still NULL when we get to
tty_set_terminal_modes?  In any case, adding some logs to those places
could show if that is the problem.

Alternatively, could it be a problem with the terminal emulators, not
in Emacs?





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

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-06-16  7:41       ` Eli Zaretskii
@ 2012-06-16 10:00         ` Chong Yidong
  2012-06-16 16:13         ` Vincent Lefevre
  1 sibling, 0 replies; 10+ messages in thread
From: Chong Yidong @ 2012-06-16 10:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 10959, vincent

I committed a patch to xterm.el that seems to stop the bug from
happening with the posted recipe.  It adds a `discard-input' call before
doing the xterm Report Background query, as is already done for the
Device Attributes query earlier in `terminal-init-xterm'.  I am still
not 100% sure of the chain of effect leading to the bug, though.





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

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-06-16  7:41       ` Eli Zaretskii
  2012-06-16 10:00         ` Chong Yidong
@ 2012-06-16 16:13         ` Vincent Lefevre
  1 sibling, 0 replies; 10+ messages in thread
From: Vincent Lefevre @ 2012-06-16 16:13 UTC (permalink / raw)
  To: Eli Zaretskii, Chong Yidong; +Cc: 10959

On 2012-06-16 10:41:26 +0300, Eli Zaretskii wrote:
> I know very little about this, but here's what I know: this feature
> relies upon the "ti" and "te" terminal capabilities.  We use these
> capabilities in tty_set_terminal_modes and tty_reset_terminal_modes,
> respectively.  In both cases, we output the terminal command only if
> the tty->output FILE stream is non-NULL.  So perhaps some timing
> issues cause tty->output to become NULL before we get to
> tty_reset_terminal_modes, or maybe it is still NULL when we get to
> tty_set_terminal_modes?

Since the bug is not always reproducible, it is likely to be a timing
problem.

> In any case, adding some logs to those places could show if that is
> the problem.

Yes, this would be a good idea.

> Alternatively, could it be a problem with the terminal emulators, not
> in Emacs?

As this problem occurs with 3 different terminal emulators (including
at least 2 very different ones: xterm and gnome-terminal), I doubt
about this.

On 2012-06-16 18:00:31 +0800, Chong Yidong wrote:
> I committed a patch to xterm.el that seems to stop the bug from
> happening with the posted recipe.  It adds a `discard-input' call before
> doing the xterm Report Background query, as is already done for the
> Device Attributes query earlier in `terminal-init-xterm'.  I am still
> not 100% sure of the chain of effect leading to the bug, though.

I wonder whether this makes the timing problem much less likely
or this is a real fix (there isn't any input from the user). Is
xterm.el also used for gnome-terminal?

Is this related to the following bug?

  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11129

-- 
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] 10+ messages in thread

* bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen
  2012-03-06 15:01 bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen Vincent Lefevre
                   ` (2 preceding siblings ...)
  2012-03-22 15:38 ` Stefan Monnier
@ 2015-10-09 12:59 ` Vincent Lefevre
  3 siblings, 0 replies; 10+ messages in thread
From: Vincent Lefevre @ 2015-10-09 12:59 UTC (permalink / raw)
  To: 10959

This bug still occurs with GNU Emacs 24.5.1 (emacs24 24.5+1-2 Debian
package). Any news?

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





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

end of thread, other threads:[~2015-10-09 12:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-06 15:01 bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen Vincent Lefevre
2012-03-22 11:19 ` Vincent Lefevre
2012-06-15 14:21   ` Vincent Lefevre
2012-06-16  6:26     ` Stefan Monnier
2012-06-16  7:41       ` Eli Zaretskii
2012-06-16 10:00         ` Chong Yidong
2012-06-16 16:13         ` Vincent Lefevre
2012-03-22 11:25 ` Vincent Lefevre
2012-03-22 15:38 ` Stefan Monnier
2015-10-09 12:59 ` Vincent Lefevre

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