GNU bug report logs - #6831
23.2; emacsclient warning "can't find socket"

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Mon, 9 Aug 2010 16:32:02 UTC

Severity: minor

Tags: notabug

Found in version 23.2

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

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


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Mon, 09 Aug 2010 16:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 09 Aug 2010 16:32:02 GMT) Full text and rfc822 format available.

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

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; emacsclient warning "can't find socket"
Date: Mon, 09 Aug 2010 17:26:55 +0100
To reproduce:

1. Emacs -q
2. (setq server-use-tcp t)
3. M-x server-start
4. emacsclient -n .

,----
| emacsclient: can't find socket; have you started the server?
| To start the server in Emacs, type "M-x server-start".
`----

In GNU Emacs 23.2.11 (x86_64-apple-darwin10.4.0) of 2010-07-23 on
 Victoria.local Windowing system distributor `Apple Inc.', version
 10.6.4

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Mon, 09 Aug 2010 17:24:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Mon, 9 Aug 2010 19:23:36 +0200
On Mon, Aug 9, 2010 at 18:26, Leo <sdl.web <at> gmail.com> wrote:
> To reproduce:
>
> 1. Emacs -q
> 2. (setq server-use-tcp t)
> 3. M-x server-start
> 4. emacsclient -n .
>
> ,----
> | emacsclient: can't find socket; have you started the server?
> | To start the server in Emacs, type "M-x server-start".
> `----

It works on Windows.

Can you debug server-start and see whether it fails to work somehow?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Mon, 09 Aug 2010 17:37:01 GMT) Full text and rfc822 format available.

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

From: Leo <sdl.web <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Mon, 09 Aug 2010 18:37:16 +0100
On 2010-08-09 18:23 +0100, Juanma Barranquero wrote:
> It works on Windows.
>
> Can you debug server-start and see whether it fails to work somehow?

Despite the warning, emacsclient connects correctly. And the warning is
from set_local_socket in emacsclient.c which I know little about. (I
suspect it may also have warnings on gnu/linux but unfortunately my
server here has gotten terribly slow these days.)

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Mon, 09 Aug 2010 17:44:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Mon, 9 Aug 2010 19:43:50 +0200
On Mon, Aug 9, 2010 at 19:37, Leo <sdl.web <at> gmail.com> wrote:

> And the warning is
> from set_local_socket in emacsclient.c which I know little about.

So the warning does disappear if you do

 emacs -Q --eval '(setq server-use-tcp t)' -f server-start
 emacsclient --server=server -n .

Does it?

If so, perhaps a permission problem trying to create a local socket?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Mon, 09 Aug 2010 17:51:02 GMT) Full text and rfc822 format available.

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

From: Leo <sdl.web <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Mon, 09 Aug 2010 18:51:16 +0100
On 2010-08-09 18:43 +0100, Juanma Barranquero wrote:
> So the warning does disappear if you do
>
>  emacs -Q --eval '(setq server-use-tcp t)' -f server-start
>  emacsclient --server=server -n .
>
> Does it?

Yes, the warning goes away.

> If so, perhaps a permission problem trying to create a local socket?

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Tue, 10 Aug 2010 08:58:02 GMT) Full text and rfc822 format available.

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

From: Leo <sdl.web <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Tue, 10 Aug 2010 09:58:11 +0100
On 2010-08-09 18:43 +0100, Juanma Barranquero wrote:
> If so, perhaps a permission problem trying to create a local socket?

I run emacsclient on a gnu/linux machine and I can still see the
warning without passing --server=server.

HTH,
Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Tue, 10 Aug 2010 18:43:01 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Tue, 10 Aug 2010 20:43:22 +0200
On Tue, Aug 10, 2010 at 10:58, Leo <sdl.web <at> gmail.com> wrote:

> I run emacsclient on a gnu/linux machine and I can still see the
> warning without passing --server=server.

Weird. Perhaps some recent change?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Mon, 04 Jul 2011 15:30:04 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Mon, 4 Jul 2011 17:28:55 +0200
> I run emacsclient on a gnu/linux machine and I can still see the
> warning without passing --server=server.

I don't think that's a bug.

You're running emacs / emacsclient in a POSIX environment, where the
default is *not* using TCP, but you're asking Emacs to use TCP:

  2. (setq server-use-tcp t)

and you're not specifying an alternate server name

  3. M-x server-start

so Emacs uses "server", the default.

Then you run emacsclient without passing --server-file (or -f), which
would ask for TCP:

  4. emacsclient -n .

so it defaults to trying local sockets first. Let's see what set_socket() does:

Try 1:
  #ifndef NO_SOCKETS_IN_FILE_SYSTEM
    /* Explicit --socket-name argument.  */
    if (socket_name)
      {
        s = set_local_socket ();
        if ((s != INVALID_SOCKET) || no_exit_if_error)
	  return s;
        message (TRUE, "%s: error accessing socket \"%s\"\n",
	         progname, socket_name);
        exit (EXIT_FAILURE);
      }
  #endif

but there's no explicit --socke-name arg, so

Try 2:
    /* Explicit --server-file arg or EMACS_SERVER_FILE variable.  */
    if (!server_file)
      server_file = egetenv ("EMACS_SERVER_FILE");

    if (server_file)
      {
        s = set_tcp_socket ();
        /* etc */
      }

but you didn't pass --server-file nor did you set EMACS_SERVER_FILE, so

Try 3:
  #ifndef NO_SOCKETS_IN_FILE_SYSTEM
    /* Implicit local socket.  */
    s = set_local_socket ();
    if (s != INVALID_SOCKET)
      return s;
  #endif

and set_local_socket tries to open the default local socket [at
(format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))], and
fails, displays the error you're seeing, and returns. So,

Try 4:
    /* Implicit server file.  */
    server_file = "server";
    s = set_tcp_socket ();
    if ((s != INVALID_SOCKET) || no_exit_if_error)
      return s;

Finally! emacsclient tries a socket with the default name, and
succeeds, so the whole run works even if set_local_socket gave us a
warning.

When you explicitly pass --server=server, you shortcut the search at
Try 2, which works so set_local_socket() is not called.

Now, perhaps set_local_socket() should be somewhat more quiet and
leave the noise to set_socket(), but it is trying to be helpful and
distinguish between different error conditions; passing that back to
set_socket() wouldn't be particulary clean or elegant.

Moral: if you're taking the trouble to set the server for TCP, take
the trouble to say that to emacsclient. If typing " -f server" is too
much trouble and you always use the default name, try setting
EMACS_SERVER_FILE.

    Juanma




Added tag(s) notabug. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 14 Jul 2011 13:43:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 6831 <at> debbugs.gnu.org and Leo <sdl.web <at> gmail.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 14 Jul 2011 13:43:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Thu, 14 Jul 2011 14:03:07 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6831 <at> debbugs.gnu.org, Leo <sdl.web <at> gmail.com>
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Thu, 14 Jul 2011 15:42:30 +0200
Juanma Barranquero <lekktu <at> gmail.com> writes:

> I don't think that's a bug.
>
> You're running emacs / emacsclient in a POSIX environment, where the
> default is *not* using TCP, but you're asking Emacs to use TCP:
>
>   2. (setq server-use-tcp t)
>
> and you're not specifying an alternate server name
>
>   3. M-x server-start
>
> so Emacs uses "server", the default.

Yeah, this doesn't seem like a bug, so I'm closing the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6831; Package emacs. (Thu, 14 Jul 2011 14:07:03 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: 6831 <at> debbugs.gnu.org, Leo <sdl.web <at> gmail.com>
Subject: Re: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Thu, 14 Jul 2011 16:05:26 +0200
On Thu, Jul 14, 2011 at 15:42, Lars Magne Ingebrigtsen <larsi <at> gnus.org> wrote:

> Yeah, this doesn't seem like a bug, so I'm closing the report.

I was waiting for Leo's answer, but it's OK to close this.

    Juanma




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

This bug report was last modified 14 years and 8 days ago.

Previous Next


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