From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Eli Zaretskii" <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: error in server-running-p on M$
Date: Sat, 22 Nov 2008 14:37:02 +0100 [thread overview]
Message-ID: <f7ccd24b0811220537k177e2c37tc8c6bac8a3fbf9b4@mail.gmail.com> (raw)
In-Reply-To: <uod07j3rx.fsf@gnu.org>
On Sat, Nov 22, 2008 at 14:20, Eli Zaretskii <eliz@gnu.org> wrote:
> Perhaps we should use the bug tracker for tracking issues as well, not
> just bug reports.
I think so.
> In that thread, Stefan answered it.
He said: "Currently it's not used (except in some people's .emacs).
The intended use is in start-server to try and prevent hijacking the
socket of a pre-existing server." But that is just part of the
answer, I think.
> Can you point me to these changes, or post them? I don't think I saw
> any diffs in that thread.
I didn't send any diffs, just posted a little snippet of code, because
the change is almost trivial. See the attached patch, which
illustrates the problem I'm talking about.
> Sorry, I don't follow: how is this related to the issue at hand?
Because, if the only intent of `server-running-p' is to "prevent
hijacking the socket" of another server, the name is quite misleading.
It does not detect (even now, for local sockets) whether another
instance is running; it only detects whether another instance is
running _with_the_same_server_setup_ (presumably because the intention
is not disturbing it).
That's why I ask about two consecutive instances of Emacs using
different names, or switching from local to TCP sockets.
`server-running-p' won't detect the first one. If that is the intended
effect, then the function should be called
`is-server-socket-available-p'.
Juanma
Index: lisp/server.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/server.el,v
retrieving revision 1.173
diff -u -2 -r1.173 server.el
--- lisp/server.el 5 Nov 2008 21:16:17 -0000 1.173
+++ lisp/server.el 7 Nov 2008 15:37:36 -0000
@@ -537,5 +537,15 @@
(unless name (setq name server-name))
(condition-case nil
- (progn
+ (if server-use-tcp
+ (with-temp-buffer
+ (insert-file-contents-literally
+ (expand-file-name server-name server-auth-dir))
+ (and (looking-at "127\.0\.0\.1:[0-9]+ \\([0-9]+\\)")
+ (let ((case-fold-search t)
+ (proc (assq 'comm
+ (system-process-attributes
+ (string-to-number (match-string 1))))))
+ (and proc
+ (string-match-p "emacs" (cdr proc))))))
(delete-process
(make-network-process
next prev parent reply other threads:[~2008-11-22 13:37 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-22 11:44 error in server-running-p on M$ dhruva
2008-11-22 11:58 ` Juanma Barranquero
2008-11-22 12:51 ` Eli Zaretskii
2008-11-22 13:00 ` Juanma Barranquero
2008-11-22 13:20 ` Eli Zaretskii
2008-11-22 13:37 ` Juanma Barranquero [this message]
2008-11-22 13:53 ` Eli Zaretskii
2008-11-22 14:13 ` Ulrich Mueller
2008-11-22 14:17 ` Juanma Barranquero
2008-11-22 14:29 ` Ulrich Mueller
2008-11-22 14:36 ` Juanma Barranquero
2008-11-22 15:35 ` Ulrich Mueller
2008-11-22 16:04 ` Juanma Barranquero
2008-11-22 16:52 ` Ulrich Mueller
2008-11-22 21:47 ` Juanma Barranquero
2008-11-23 3:56 ` dhruva
2008-11-23 3:59 ` Juanma Barranquero
2008-11-23 4:01 ` dhruva
2008-11-23 4:03 ` Juanma Barranquero
2008-11-23 4:10 ` dhruva
2008-11-23 4:15 ` Juanma Barranquero
2008-11-23 4:17 ` dhruva
2008-11-23 4:19 ` Juanma Barranquero
2008-11-23 8:14 ` Server protocol (was: Re: error in server-running-p on M$) Ulrich Mueller
2008-11-23 11:33 ` Juanma Barranquero
2008-11-23 16:33 ` dhruva
2008-11-23 17:48 ` Juanma Barranquero
2008-11-23 4:02 ` error in server-running-p on M$ Stefan Monnier
2008-11-23 4:10 ` Juanma Barranquero
2008-11-23 5:21 ` Stefan Monnier
2008-11-23 5:32 ` Juanma Barranquero
2008-11-23 5:57 ` Stefan Monnier
2008-11-23 11:26 ` Juanma Barranquero
2008-11-23 12:46 ` Juanma Barranquero
2008-11-23 13:13 ` Ulrich Mueller
2008-11-24 2:55 ` Stefan Monnier
2008-11-24 14:46 ` Juanma Barranquero
2008-11-24 15:10 ` Ulrich Mueller
2008-11-24 15:16 ` Juanma Barranquero
2008-11-24 15:34 ` Ulrich Mueller
2008-11-24 15:45 ` Juanma Barranquero
2008-12-09 20:46 ` Stefan Monnier
2008-12-10 7:05 ` Chetan Pandya
2008-12-10 12:59 ` Juanma Barranquero
2008-12-10 18:30 ` Stefan Monnier
2008-12-10 18:47 ` Juanma Barranquero
2008-12-11 2:07 ` Stefan Monnier
2008-12-11 16:30 ` Juanma Barranquero
2008-12-11 18:47 ` Stefan Monnier
2008-12-12 0:40 ` Juanma Barranquero
2008-12-12 4:51 ` Stefan Monnier
2008-12-12 8:19 ` Juanma Barranquero
2008-12-12 18:49 ` Stefan Monnier
2008-12-12 20:20 ` Juanma Barranquero
2008-11-23 3:58 ` Stefan Monnier
2008-11-23 3:59 ` Stefan Monnier
2008-11-23 4:12 ` Juanma Barranquero
2008-11-23 5:19 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7ccd24b0811220537k177e2c37tc8c6bac8a3fbf9b4@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.