unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6831: 23.2; emacsclient warning "can't find socket"
@ 2010-08-09 16:26 Leo
  2010-08-09 17:23 ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2010-08-09 16:26 UTC (permalink / raw)
  To: 6831

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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-09 16:26 bug#6831: 23.2; emacsclient warning "can't find socket" Leo
@ 2010-08-09 17:23 ` Juanma Barranquero
  2010-08-09 17:37   ` Leo
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2010-08-09 17:23 UTC (permalink / raw)
  To: Leo; +Cc: 6831

On Mon, Aug 9, 2010 at 18:26, Leo <sdl.web@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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-09 17:23 ` Juanma Barranquero
@ 2010-08-09 17:37   ` Leo
  2010-08-09 17:43     ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2010-08-09 17:37 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6831

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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-09 17:37   ` Leo
@ 2010-08-09 17:43     ` Juanma Barranquero
  2010-08-09 17:51       ` Leo
  2010-08-10  8:58       ` Leo
  0 siblings, 2 replies; 10+ messages in thread
From: Juanma Barranquero @ 2010-08-09 17:43 UTC (permalink / raw)
  To: Leo; +Cc: 6831

On Mon, Aug 9, 2010 at 19:37, Leo <sdl.web@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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-09 17:43     ` Juanma Barranquero
@ 2010-08-09 17:51       ` Leo
  2010-08-10  8:58       ` Leo
  1 sibling, 0 replies; 10+ messages in thread
From: Leo @ 2010-08-09 17:51 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6831

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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-09 17:43     ` Juanma Barranquero
  2010-08-09 17:51       ` Leo
@ 2010-08-10  8:58       ` Leo
  2010-08-10 18:43         ` Juanma Barranquero
  2011-07-04 15:28         ` Juanma Barranquero
  1 sibling, 2 replies; 10+ messages in thread
From: Leo @ 2010-08-10  8:58 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6831

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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-10  8:58       ` Leo
@ 2010-08-10 18:43         ` Juanma Barranquero
  2011-07-04 15:28         ` Juanma Barranquero
  1 sibling, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2010-08-10 18:43 UTC (permalink / raw)
  To: Leo; +Cc: 6831

On Tue, Aug 10, 2010 at 10:58, Leo <sdl.web@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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2010-08-10  8:58       ` Leo
  2010-08-10 18:43         ` Juanma Barranquero
@ 2011-07-04 15:28         ` Juanma Barranquero
  2011-07-14 13:42           ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-07-04 15:28 UTC (permalink / raw)
  To: Leo; +Cc: 6831

> 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





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2011-07-04 15:28         ` Juanma Barranquero
@ 2011-07-14 13:42           ` Lars Magne Ingebrigtsen
  2011-07-14 14:05             ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-14 13:42 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 6831, Leo

Juanma Barranquero <lekktu@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/





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

* bug#6831: 23.2; emacsclient warning "can't find socket"
  2011-07-14 13:42           ` Lars Magne Ingebrigtsen
@ 2011-07-14 14:05             ` Juanma Barranquero
  0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2011-07-14 14:05 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 6831, Leo

On Thu, Jul 14, 2011 at 15:42, Lars Magne Ingebrigtsen <larsi@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





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

end of thread, other threads:[~2011-07-14 14:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-09 16:26 bug#6831: 23.2; emacsclient warning "can't find socket" Leo
2010-08-09 17:23 ` Juanma Barranquero
2010-08-09 17:37   ` Leo
2010-08-09 17:43     ` Juanma Barranquero
2010-08-09 17:51       ` Leo
2010-08-10  8:58       ` Leo
2010-08-10 18:43         ` Juanma Barranquero
2011-07-04 15:28         ` Juanma Barranquero
2011-07-14 13:42           ` Lars Magne Ingebrigtsen
2011-07-14 14:05             ` Juanma Barranquero

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