unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Emacsserver socket file not removed on exit
@ 2006-05-15 18:23 Tacvek
  0 siblings, 0 replies; 4+ messages in thread
From: Tacvek @ 2006-05-15 18:23 UTC (permalink / raw)


The socket file of emacsserver is not removed when Emacs is exited.
As far as I can tell, the only thing that causes the server to delete the 
file
is (server-start t), which is called by emacsserver's unload hook.

Presumably the server library is supposed to be unloaded as part
of the emacs exiting process, however emacs does not seem to be doing that.

This bug is found in CVS HEAD of GNU Emacs, and breaks
scripts such as 'etc/emacs.bash'.

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

* Re: Emacsserver socket file not removed  on exit
       [not found] <E1FfrAD-0007qG-7b@fencepost.gnu.org>
@ 2006-05-16  6:54 ` Stefan Monnier
  2006-05-16 17:25   ` Tacvek
       [not found]   ` <mailman.1911.1147800366.9609.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2006-05-16  6:54 UTC (permalink / raw)
  Cc: bug-gnu-emacs, emacs-devel

> Would someone please study this and DTRT?

I've just installed the patch below which should fix it.

> The socket file of emacsserver is not removed when Emacs is exited.
> As far as I can tell, the only thing that causes the server to delete the
> file is (server-start t), which is called by emacsserver's unload hook.

Can you confirm that the patch below fixes it for you?


        Stefan


--- server.el	07 mai 2006 10:06:52 -0400	1.110
+++ server.el	16 mai 2006 02:49:31 -0400	
@@ -252,8 +252,6 @@
 
 Prefix arg means just kill any existing server communications subprocess."
   (interactive "P")
-  ;; Make sure there is a safe directory in which to place the socket.
-  (server-ensure-safe-dir server-socket-dir)
   ;; kill it dead!
   (if server-process
       (condition-case () (delete-process server-process) (error nil)))
@@ -265,7 +263,10 @@
   (while server-clients
     (let ((buffer (nth 1 (car server-clients))))
       (server-buffer-done buffer)))
+  ;; Now any previous server is properly stopped.
   (unless leave-dead
+    ;; Make sure there is a safe directory in which to place the socket.
+    (server-ensure-safe-dir server-socket-dir)
     (if server-process
 	(server-log (message "Restarting server")))
     (letf (((default-file-modes) ?\700))
@@ -578,7 +579,7 @@
   (if (or arg
 	  (not server-process)
 	  (memq (process-status server-process) '(signal exit)))
-      (server-start nil)
+      (server-mode 1)
     (apply 'server-switch-buffer (server-done))))
 
 (defun server-switch-buffer (&optional next-buffer killed-one)
@@ -637,14 +638,15 @@
 (define-key ctl-x-map "#" 'server-edit)
 
 (defun server-unload-hook ()
-  (server-start t)
+  (server-mode -1)
   (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)
   (remove-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
   (remove-hook 'kill-buffer-hook 'server-kill-buffer))
 
+(add-hook 'kill-emacs-hook (lambda () (server-mode -1))) ;Cleanup upon exit.
 (add-hook 'server-unload-hook 'server-unload-hook)
 \f
 (provide 'server)
 
-;;; arch-tag: 1f7ecb42-f00a-49f8-906d-61995d84c8d6
+;; arch-tag: 1f7ecb42-f00a-49f8-906d-61995d84c8d6
 ;;; server.el ends here

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

* Re: Emacsserver socket file not removed  on exit
  2006-05-16  6:54 ` Stefan Monnier
@ 2006-05-16 17:25   ` Tacvek
       [not found]   ` <mailman.1911.1147800366.9609.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Tacvek @ 2006-05-16 17:25 UTC (permalink / raw)
  Cc: bug-gnu-emacs, emacs-devel


----- Original Message ----- 
From: "Stefan Monnier" <monnier@iro.umontreal.ca>
To: <rms@gnu.org>; "Tacvek" <unknown_kev_cat@hotmail.com>
Cc: <emacs-devel@gnu.org>; <bug-gnu-emacs@gnu.org>
Sent: Tuesday, May 16, 2006 2:54 AM
Subject: Re: Emacsserver socket file not removed on exit


>> Would someone please study this and DTRT?
>
> I've just installed the patch below which should fix it.
>
>> The socket file of emacsserver is not removed when Emacs is exited.
>> As far as I can tell, the only thing that causes the server to delete the
>> file is (server-start t), which is called by emacsserver's unload hook.
>
> Can you confirm that the patch below fixes it for you?

The patch does indeed fix it.
It seems a little strange that nobody had yet caught this, as it broke 
etc/emacs.bash fairly badly.

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

* Re: Emacsserver socket file not removed  on exit
       [not found]   ` <mailman.1911.1147800366.9609.bug-gnu-emacs@gnu.org>
@ 2006-05-18  3:07     ` Burton Samograd
  0 siblings, 0 replies; 4+ messages in thread
From: Burton Samograd @ 2006-05-18  3:07 UTC (permalink / raw)


"Tacvek" <unknown_kev_cat@hotmail.com> writes:
>>> The socket file of emacsserver is not removed when Emacs is exited.
>>> As far as I can tell, the only thing that causes the server to delete the
>>> file is (server-start t), which is called by emacsserver's unload hook.
>>
>> Can you confirm that the patch below fixes it for you?
>
> The patch does indeed fix it.
> It seems a little strange that nobody had yet caught this, as it broke
> etc/emacs.bash fairly badly.

Odd, I just found this last week and added a kill-emacs-hook to get
rid of it...never thought it was a bug.

-- 
burton samograd					kruhft .at. gmail
kruhft.blogspot.com	www.myspace.com/kruhft	metashell.blogspot.com

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

end of thread, other threads:[~2006-05-18  3:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-15 18:23 Emacsserver socket file not removed on exit Tacvek
     [not found] <E1FfrAD-0007qG-7b@fencepost.gnu.org>
2006-05-16  6:54 ` Stefan Monnier
2006-05-16 17:25   ` Tacvek
     [not found]   ` <mailman.1911.1147800366.9609.bug-gnu-emacs@gnu.org>
2006-05-18  3:07     ` Burton Samograd

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