From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Re: error in server-running-p on M$ Date: Sat, 22 Nov 2008 14:37:02 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1227361050 13867 80.91.229.12 (22 Nov 2008 13:37:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Nov 2008 13:37:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Eli Zaretskii" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 22 14:38:33 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L3sgw-0005GQ-TF for ged-emacs-devel@m.gmane.org; Sat, 22 Nov 2008 14:38:31 +0100 Original-Received: from localhost ([127.0.0.1]:56239 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L3sfn-0001E6-N9 for ged-emacs-devel@m.gmane.org; Sat, 22 Nov 2008 08:37:19 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L3sfZ-00015k-NX for emacs-devel@gnu.org; Sat, 22 Nov 2008 08:37:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L3sfY-00014h-5E for emacs-devel@gnu.org; Sat, 22 Nov 2008 08:37:04 -0500 Original-Received: from [199.232.76.173] (port=35134 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L3sfX-00014J-Q8 for emacs-devel@gnu.org; Sat, 22 Nov 2008 08:37:03 -0500 Original-Received: from yw-out-1718.google.com ([74.125.46.155]:63809) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L3sfX-0007y1-Gh for emacs-devel@gnu.org; Sat, 22 Nov 2008 08:37:03 -0500 Original-Received: by yw-out-1718.google.com with SMTP id 9so645526ywk.66 for ; Sat, 22 Nov 2008 05:37:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=7pQjv9IJD/bsKThLOvfHJT7Ul3KIRfQCNtWU1s87xTA=; b=FR4DvdPt86r3I1c+CoYEQemPq/tRWbaWWxDOLnRHaAHcH4+eH5fvVbNy0AB2vGKV6b TyNjGzgRvgO2zXubvLC8h0LmxS06yxKh44/WzRnQE8ULO/SA5CsUfJHNF4h6udsETxwG Ks5purqo5zN6qH4AvVkbREP9b3vBPT1j/A7Ro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ayWNyDh54VRbOYxkgkxbnv7WUnFHt/Qj+NTbkgFM2hCMndZOf5ed5BjbVNUduyAz90 A6qgEQMdgoHGnySemKq4XoMgSJ9hW9XAsVdQjhHJ+fP8tRjvNW+zNsbe4PoCV03bwp/c wCWWcX3RwVYbsN6SXHVFqXdrXfSAOchnSHXhY= Original-Received: by 10.100.178.9 with SMTP id a9mr714297anf.59.1227361022341; Sat, 22 Nov 2008 05:37:02 -0800 (PST) Original-Received: by 10.100.13.13 with HTTP; Sat, 22 Nov 2008 05:37:02 -0800 (PST) In-Reply-To: Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:105949 Archived-At: On Sat, Nov 22, 2008 at 14:20, Eli Zaretskii 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