From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.bugs Subject: bug#16892: 24.3; terminal corruption after emacsclient -t & Date: Thu, 27 Feb 2014 13:50:22 +0000 Message-ID: <87mwhc64wx.fsf@msstf091.ucc.ie> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1393509242 17298 80.91.229.3 (27 Feb 2014 13:54:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Feb 2014 13:54:02 +0000 (UTC) To: 16892@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 27 14:54:08 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WJ1PW-00048b-Gg for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Feb 2014 14:54:02 +0100 Original-Received: from localhost ([::1]:46109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ1PV-0003sv-Op for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Feb 2014 08:54:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ1Ng-0001QC-Q4 for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:52:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJ1Na-0004W2-VV for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:52:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ1Na-0004VE-QW for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WJ1Na-0003xC-Gs for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Feb 2014 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16892 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.139350907215113 (code B ref -1); Thu, 27 Feb 2014 13:52:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Feb 2014 13:51:12 +0000 Original-Received: from localhost ([127.0.0.1]:42232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ1Ml-0003vg-N1 for submit@debbugs.gnu.org; Thu, 27 Feb 2014 08:51:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51475) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ1Mi-0003vV-L1 for submit@debbugs.gnu.org; Thu, 27 Feb 2014 08:51:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJ1Mc-0004C1-Lm for submit@debbugs.gnu.org; Thu, 27 Feb 2014 08:51:08 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ1Mc-0004Bu-BB for submit@debbugs.gnu.org; Thu, 27 Feb 2014 08:51:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ1MW-0007uu-Q5 for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:51:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJ1MQ-00047R-JE for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:50:56 -0500 Original-Received: from co9ehsobe004.messaging.microsoft.com ([207.46.163.27]:32655 helo=co9outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ1MQ-00043U-8R for bug-gnu-emacs@gnu.org; Thu, 27 Feb 2014 08:50:50 -0500 Original-Received: from mail87-co9-R.bigfish.com (10.236.132.232) by CO9EHSOBE036.bigfish.com (10.236.130.99) with Microsoft SMTP Server id 14.1.225.22; Thu, 27 Feb 2014 13:50:27 +0000 Original-Received: from mail87-co9 (localhost [127.0.0.1]) by mail87-co9-R.bigfish.com (Postfix) with ESMTP id 8E7A0C02F9 for ; Thu, 27 Feb 2014 13:50:27 +0000 (UTC) X-Forefront-Antispam-Report: CIP:143.239.1.23; KIP:(null); UIP:(null); IPV:NLI; H:mail3.ucc.ie; RD:mail3.ucc.ie; EFVD:NLI X-SpamScore: 3 X-BigFish: VPS3(zz936eI13e6Kde40h173nzz1f42h208ch1ee6h1de0h1d18h1fdah21bdh2073h2146h1202h1e76h2189h1d1ah1d2ah21a7h1fc6hzz8275dh1de097hz2dh2a8h839hd24he5bhf0ahfa3h107ah11b5h121eh1288h12a5h12bdh137ah1441h14afh1504h1537h153bh162dh1631h1758h18e1h1946h19b5h1b0ah1bceh2222h224fh1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e1dh1fe8h1ff5h20f0h2216h22d0h2336h2438h2461h2487h24d7h2516h2545h255eh2388i34h41h1155h) Original-Received: from mail87-co9 (localhost.localdomain [127.0.0.1]) by mail87-co9 (MessageSwitch) id 1393509024789210_15892; Thu, 27 Feb 2014 13:50:24 +0000 (UTC) Original-Received: from CO9EHSMHS014.bigfish.com (unknown [10.236.132.253]) by mail87-co9.bigfish.com (Postfix) with ESMTP id BCEC1180070 for ; Thu, 27 Feb 2014 13:50:24 +0000 (UTC) Original-Received: from mail3.ucc.ie (143.239.1.23) by CO9EHSMHS014.bigfish.com (10.236.130.24) with Microsoft SMTP Server (TLS) id 14.16.227.3; Thu, 27 Feb 2014 13:50:24 +0000 Original-Received: from msstf091.ucc.ie (msstf091.ucc.ie [143.239.76.91]) by mail3.ucc.ie (8.14.4/8.14.4) with ESMTP id s1RDoM9g030789 for ; Thu, 27 Feb 2014 13:50:22 GMT Original-Received: by msstf091.ucc.ie (Postfix, from userid 1000) id 296C6A2EDE; Thu, 27 Feb 2014 13:50:22 +0000 (GMT) X-OriginatorOrg: ucc.ie X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:86304 Archived-At: --=-=-= Content-Type: text/plain after doing: emacs -Q -f server-start& emacsclient -t & from a terminal, the terminal gets corrupted. The terminal shows the emacs buffer, but the shell and not emacs receives the keystrokes. Expected behaviour would be to stop emacsclient immediately when it is started in the backround and needs the current tty. This would be consistent with behaviour of "emacs -Q -nw &" The attached patch for emacsclient.c fixes this problem by checking if emacsclient is started in the background, and raising SIGSTOP, if that is the case. This fixes the problem for me, but I cannot guarantee that this has no side effects. In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.7) of 2014-01-28 on var-lib-archbuild-extra-x86_64-juergen Windowing system distributor `The X.Org Foundation', version 11.0.11500000 System Description: Arch Linux Configured using: `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib' '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft' 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: 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 blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml 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 help-mode easymenu time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment 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 macroexp 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) --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename="0001-Fix-emacsclient-s-behavior-when-started-in-backgroun.patch" >From f80558a9b708e08f3a9fc1b0c1aed65b1a43282d Mon Sep 17 00:00:00 2001 From: Andreas Amann Date: Tue, 25 Feb 2014 21:28:44 +0000 Subject: [PATCH] Fix emacsclient's behavior when started in background * emacsclient.c (main): raise SIGSTOP if emacsclient process is started in the background in tty mode. --- lib-src/ChangeLog | 2 ++ lib-src/emacsclient.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index bd0a16e..cf367ab 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -2,6 +2,8 @@ Fix emacsclient's handling of SIGCONT (Bug#16883). * emacsclient.c (handle_sigcont): Cancel the continue only if tty. + (main): raise SIGSTOP if emacsclient process is started in the + background in tty mode. 2014-01-22 Eli Zaretskii diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 148182a..7bed240 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1554,6 +1554,13 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } +#if !defined (NO_SOCKETS_IN_FILE_SYSTEM) + if (tcgetpgrp (1) != getpgrp () && tty) + { + raise(SIGSTOP); + } +#endif /* NO_SOCKETS_IN_FILE_SYSTEM */ + /* If alternate_editor is the empty string, start the emacs daemon in case of failure to connect. */ start_daemon_if_needed = (alternate_editor -- 1.9.0 --=-=-=--