GNU bug report logs - #16883
[PATCH] Fix emacsclient's handling of SIGCONT.

Previous Next

Package: emacs;

Reported by: Andreas Amann <a.amann <at> ucc.ie>

Date: Tue, 25 Feb 2014 18:47:01 UTC

Severity: normal

Tags: patch

Found in version 24.3

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 16883 in the body.
You can then email your comments to 16883 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


Acknowledgement sent to Andreas Amann <a.amann <at> ucc.ie>:
New bug report received and filed, but not forwarded. (Tue, 25 Feb 2014 18:47:01 GMT) Full text and rfc822 format available.

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

From: Andreas Amann <a.amann <at> ucc.ie>
To: quiet <at> debbugs.gnu.org
Subject: [PATCH] Fix emacsclient's handling of SIGCONT.
Date: Thu, 20 Feb 2014 00:05:30 +0000
Package: emacs
Version: 24.3

[ Resent from
http://lists.gnu.org/archive/html/emacs-devel/2014-02/msg00467.html ]

* emacsclient.c (handle_sigcont):  previously it was not possible
to run emacsclient in the background using "bg", because SIGCONT
was blocked in this case.  Now SIGCONT is only blocked if the
Emacs frame is opened on the current terminal.
---

There is an annoying problem with backgrounding of emacsclient
processes. 
To illustrate the problem, do the following:

>emacs -Q -f server-start &
[1] xxxPID1xxx
>emacsclient -c filename
Waiting for Emacs...^Z (press control-z)
[2]+  Stopped                 emacsclient -c filename
>bg
[2]+ emacsclient -c ~/.bashrc &

[2]+  Stopped                 emacsclient -c ~/.bashrc

At this point, emacsclient is stopped and not running in the background
as it should after receiving the SIGCONT signal through "bg". We can
still go to the second emacs frame showing "filename", finish editing
the file and leave the frame with C-x #.  After this, the emacsclient is
stalled in the "Stopped" state, and does not exit as it should.  

It will only exit after issuing
>fg

The attached patch fixes this by only stopping emacsclient, if the emacs
frame is opened in the current terminal. 


 lib-src/ChangeLog     | 8 ++++++++
 lib-src/emacsclient.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 5005e1f..1c2862f 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-19  Andreas Amann  <a.amann <at> ucc.ie>
+
+	Fix emacsclient's handling of SIGCONT.
+	* emacsclient.c (handle_sigcont): previously it was not possible
+	to run emacsclient in the background using "bg", because SIGCONT
+	was blocked in this case.  Now SIGCONT is only blocked if the
+	Emacs frame is opened on the current terminal.
+
 2014-01-22  Eli Zaretskii  <eliz <at> gnu.org>
 
 	* update-game-score.c (write_scores) [WINDOWSNT]: Use chmod
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 6593b91..fd85a50 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1111,7 +1111,7 @@ handle_sigcont (int signalnum)
       /* We are in the foreground. */
       send_to_emacs (emacs_socket, "-resume \n");
     }
-  else
+  else if (tty)
     {
       /* We are in the background; cancel the continue. */
       raise (SIGSTOP);
-- 
1.8.5.4




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 25 Feb 2014 19:08:01 GMT) Full text and rfc822 format available.

Notification sent to Andreas Amann <a.amann <at> ucc.ie>:
bug acknowledged by developer. (Tue, 25 Feb 2014 19:08:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: a.amann <at> ucc.ie, 16883-done <at> debbugs.gnu.org
Subject: Re: [PATCH] Fix emacsclient's handling of SIGCONT.
Date: Tue, 25 Feb 2014 11:07:47 -0800
Thanks for the bug report.  I applied that change as part of Emacs trunk 
bzr 116558.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 26 Mar 2014 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 34 days ago.

Previous Next


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