all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Leo <sdl.web@gmail.com>
Cc: 6831@debbugs.gnu.org
Subject: bug#6831: 23.2; emacsclient warning "can't find socket"
Date: Mon, 4 Jul 2011 17:28:55 +0200	[thread overview]
Message-ID: <CAAeL0SSAkj953E9EHiMzVgW3VFNMfEEmc0QCXjr803XxbAjwsw@mail.gmail.com> (raw)
In-Reply-To: <m1eie6alp8.fsf@cam.ac.uk>

> 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





  parent reply	other threads:[~2011-07-04 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-07-14 13:42           ` Lars Magne Ingebrigtsen
2011-07-14 14:05             ` Juanma Barranquero

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=CAAeL0SSAkj953E9EHiMzVgW3VFNMfEEmc0QCXjr803XxbAjwsw@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=6831@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    /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.