emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error in server-running-p on M$


From: Stefan Monnier
Subject: Re: error in server-running-p on M$
Date: Tue, 09 Dec 2008 15:46:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> WDYT about the following patch?

Looks good, tho see comment below.

>    ;; Delete the associated connection file, if applicable.
> -  ;; This is actually problematic: the file may have been overwritten by
> -  ;; another Emacs server in the mean time, so it's not ours any more.
> -  ;; (and (process-contact proc :server)
> -  ;;      (eq (process-status proc) 'closed)
> -  ;;      (ignore-errors (delete-file (process-get proc :server-file))))
> +  (and (process-contact proc :server)
> +       (eq (process-status proc) 'closed)
> +       (ignore-errors (delete-file (process-get proc :server-file))))
>    (server-log (format "Status changed to %s: %s" (process-status

It would be good to keep some comment about the fact that we don't know
for sure that the file is ours.

> +      (if (not (server-running-p server-name))
> +       (ignore-errors (delete-file server-file))
> +     (setq server-mode nil)  ;; already set by the minor mode code
> +     (error "Server %S is already running" server-name))

As Ulrich points out, we should make sure that we can always somehow
start a server.

> -  "Test whether server NAME is running."
> +  "Test whether server NAME is running.
> +NOTE: This function is intended to be called from `server-start'
> +and it is NOT 100% reliable."

Just saying it's unreliable is not sufficient.  We need to give some
guarantee about what kind of incorrect result we may get.  E.g. it could
return t, nil, or `not-sure'.
Also we should describe the reason for the unreliability: we prefer
giving an immediate response over risking non-termination.

Finally, for the purpose of server-start, we don't necessarily care if
there is a server named "foo" running on some other machine, so maybe in
the server-use-tcp case, if the IP is not 127.0.0.1, server-running-p
might return a special value like `remote' and server-start might treat
it like "not running" (i.e. it will remove the server-file).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]