GNU logs - #14491, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#14491: emacs -nw doesn't always restore the terminal screen
Resent-From: "Andries E. Brouwer" <Andries.Brouwer@HIDDEN>
Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 28 May 2013 18:37:01 +0000
Resent-Message-ID: <handler.14491.B.136976621110560 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 14491
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 14491 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.136976621110560
          (code B ref -1); Tue, 28 May 2013 18:37:01 +0000
Received: (at submit) by debbugs.gnu.org; 28 May 2013 18:36:51 +0000
Received: from localhost ([127.0.0.1]:37857 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UhOlP-0002kH-9d
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 14:36:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52167)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <Andries.Brouwer@HIDDEN>) id 1UhOYk-0002LD-2L
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 14:23:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Andries.Brouwer@HIDDEN>) id 1UhOXH-0008Ua-Hf
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 14:22:21 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
	autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:36268)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Andries.Brouwer@HIDDEN>) id 1UhOXH-0008UW-EN
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 14:22:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35279)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Andries.Brouwer@HIDDEN>) id 1UhOXE-0000hw-FT
	for bug-gnu-emacs@HIDDEN; Tue, 28 May 2013 14:22:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Andries.Brouwer@HIDDEN>) id 1UhOX9-0008TY-LE
	for bug-gnu-emacs@HIDDEN; Tue, 28 May 2013 14:22:12 -0400
Received: from fester.cwi.nl ([192.16.191.27]:60193)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Andries.Brouwer@HIDDEN>) id 1UhOX9-0008TH-Cj
	for bug-gnu-emacs@HIDDEN; Tue, 28 May 2013 14:22:07 -0400
Received: from fester.cwi.nl (fester.cwi.nl [192.16.191.27]) by fester.cwi.nl
	with ESMTP id r4SIM4Qo025526 for ; Tue, 28 May 2013 20:22:04 +0200
Received: from localhost (a80-101-109-117.adsl.xs4all.nl [80.101.109.117])
	(authenticated bits=0)
	by fester.cwi.nl (8.14.4/8.12.3) with ESMTP id r4SIM4tV025524
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);
	Tue, 28 May 2013 20:22:04 +0200
Date: Tue, 28 May 2013 20:22:01 +0200
From: "Andries E. Brouwer" <Andries.Brouwer@HIDDEN>
Message-ID: <20130528182159.GA22032@jp>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Mailman-Approved-At: Tue, 28 May 2013 14:36:50 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Sometimes after exiting "emacs -nw" the cursor is left
in the middle of a former terminal buffer, so that one
has to search for the bash prompt among former buffer text.
Sometimes the cursor position is OK, but the screen is not restored.

On my old computer I saw this sporadically, now I see it regularly.
It feels like a timing issue.

Probably the same issue was reported by Vincent Lefevre
in bug#10959 for emacs 23.3. That was also my working emacs,
but I verified that emacs 24.3 has the same issue.

Running the session under script shows what emacs sends to the
xterm pseudoterminal.

When all works as expected one sees something like
^[[?12l^[[?25h^[[?12;25h^[[>4m^[[48d^[[?1l^[>^[[?12l^[[?25h^[[?1049l^[[39;49m^M
upon exit. In the cases that fail it is something like
^[[?12l^[[?25h^[[?12;25h^[[>4m^[[48d^[[K

The essential difference for the purposes of this bug is ^[[?1049l,
the "te" capability ("rmcup" in terminfo terms), that restores
terminal state.

First solution:

Replace the invocation "emacs -nw --no-splash file" by
"emacs -nw --no-splash file; tput rmcup".
Now all is fine.

Second solution:

The "^[[>4m" here is from xterm-remove-modify-other-keys
which is attached to kill-emacs-hook. If I remove it,
I no longer see the problem. (Maybe only the timing is changed,
maybe this really helps. One could imagine that the same terminal
is approached via several buffered output streams, and that a
second simultaneous invocation of a terminal write kills the first.)

The ^[[?1l^[>^[[?12l^[[?25h^[[?1049l^[[39;49m^M" comes from
tty_reset_terminal_modes();
It contains a fflush (tty->output); Adding an fsync() there
does not help. An additional sleep for a few seconds does not
help either.

Third solution:

If I add another
OUTPUT_IF (tty, tty->TS_end_termcap_modes); fflush (tty->output);
at the end of tty_reset_terminal_modes();
I no longer see the problem.

Proper solution: no idea.
What sources of concurrency are there? Does emacs use threads?
Does emacs write to several file descriptors that ultimately
refer to the same pty?

Since this is tested via script, the properties of xterm do not seem
to play a role.

Andries




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.428 (Entity 5.428)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: "Andries E. Brouwer" <Andries.Brouwer@HIDDEN>
Subject: bug#14491: Acknowledgement (emacs -nw doesn't always restore the
 terminal screen)
Message-ID: <handler.14491.B.136976621110560.ack <at> debbugs.gnu.org>
References: <20130528182159.GA22032@jp>
X-Gnu-PR-Message: ack 14491
X-Gnu-PR-Package: emacs
Reply-To: 14491 <at> debbugs.gnu.org
Date: Tue, 28 May 2013 18:37:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 14491 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
14491: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14491
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 29 May 2013 02:54:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 28 22:54:14 2013
Received: from localhost ([127.0.0.1]:38488 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UhWWj-0000nv-Pk
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 22:54:13 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:47169 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1UhWWi-0000no-0G
	for control <at> debbugs.gnu.org; Tue, 28 May 2013 22:54:12 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>) id 1UhWVO-0007uu-0K
	for control <at> debbugs.gnu.org; Tue, 28 May 2013 22:52:50 -0400
Date: Tue, 28 May 2013 22:52:50 -0400
Message-Id: <E1UhWVO-0007uu-0K@HIDDEN>
Subject: control message for bug 14491
To: <control <at> debbugs.gnu.org>
X-Mailer: mail (GNU Mailutils 2.1)
From: Glenn Morris <rgm@HIDDEN>
X-Spam-Score: -5.3 (-----)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

merge 10959 14491




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#14491: emacs -nw doesn't always restore the terminal screen
References: <20130528182159.GA22032@jp>
In-Reply-To: <20130528182159.GA22032@jp>
Resent-From: "Andries E. Brouwer" <Andries.Brouwer@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 02 Aug 2013 16:57:01 +0000
Resent-Message-ID: <handler.14491.B14491.137546258215013 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 14491
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 14491 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
X-Debbugs-Original-Cc: 14491 <at> debbugs.gnu.org
Received: via spool by 14491-submit <at> debbugs.gnu.org id=B14491.137546258215013
          (code B ref 14491); Fri, 02 Aug 2013 16:57:01 +0000
Received: (at 14491) by debbugs.gnu.org; 2 Aug 2013 16:56:22 +0000
Received: from localhost ([127.0.0.1]:36683 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1V5IeL-0003u3-OI
	for submit <at> debbugs.gnu.org; Fri, 02 Aug 2013 12:56:22 -0400
Received: from fester.cwi.nl ([192.16.191.27]:48978)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <Andries.Brouwer@HIDDEN>) id 1V5IeI-0003tb-FY
 for 14491 <at> debbugs.gnu.org; Fri, 02 Aug 2013 12:56:19 -0400
Received: from fester.cwi.nl (fester.cwi.nl [192.16.191.27]) by fester.cwi.nl
 with ESMTP id r72GuCbb011175 for ; Fri, 2 Aug 2013 18:56:12 +0200
Received: from localhost (a80-101-109-117.adsl.xs4all.nl [80.101.109.117])
 (authenticated bits=0)
 by fester.cwi.nl (8.14.4/8.12.3) with ESMTP id r72GuBEr011173
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);
 Fri, 2 Aug 2013 18:56:11 +0200
Date: Fri, 2 Aug 2013 18:56:05 +0200
From: "Andries E. Brouwer" <Andries.Brouwer@HIDDEN>
Message-ID: <20130802165603.GA13204@jp>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: -1.4 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

Two months ago I wrote

> Sometimes after exiting "emacs -nw" the cursor is left
> in the middle of a former terminal buffer.
> It feels like a timing issue.

Yesterday I had a different emacs problem (utf-8 pasted
into an emacs -nw buffer was corrupted when preceded by an
ESC-q command, for any q), and debugging showed that the problem
was not with emacs but with luit, a layer that sits between
xterm and emacs -nw. Since luit parses its input and recognizes
escape sequences, it is in a state where it truncates UTF-8
when it thinks it is reading an ISO 2022 escape sequence.

OK - so emacs -nw under luit has some strange corruption issues.

Returning to this old problem, I now conjecture that also that was
caused by luit. It is somewhat difficult to reproduce, but a moment ago
I did reproduce it once with emacs -nw under luit, and saw no problems
without luit.

Perhaps the problem has been solved and no emacs fixes are required.

Andries





Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 2 Aug 2013 21:27:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 02 17:27:44 2013
Received: from localhost ([127.0.0.1]:37099 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1V5Msx-00043m-Dl
	for submit <at> debbugs.gnu.org; Fri, 02 Aug 2013 17:27:43 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:47661 ident=Debian-exim)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rgm@HIDDEN>) id 1V5Msv-00043d-Lo
 for control <at> debbugs.gnu.org; Fri, 02 Aug 2013 17:27:41 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
 (envelope-from <rgm@HIDDEN>) id 1V5Msv-0001kI-9n
 for control <at> debbugs.gnu.org; Fri, 02 Aug 2013 17:27:41 -0400
Date: Fri, 02 Aug 2013 17:27:41 -0400
Message-Id: <E1V5Msv-0001kI-9n@HIDDEN>
Subject: control message for bug 15013
To: <control <at> debbugs.gnu.org>
X-Mailer: mail (GNU Mailutils 2.1)
From: Glenn Morris <rgm@HIDDEN>
X-Spam-Score: -6.5 (------)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.5 (------)

merge 14491 15013





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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