emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: emacsclient horribly broken


From: Tim Van Holder
Subject: Re: emacsclient horribly broken
Date: Thu, 2 Nov 2006 09:39:51 +0100

On 11/1/06, Juanma Barranquero <address@hidden> wrote:
On 11/1/06, Tim Van Holder <address@hidden> wrote:

> so this patch is completely untested (not even compiled).  I will test it
> at work tomorrow, unless someone else verifies it in the meantime.

I'll wait till you've had the time to test it. I don't want to raise
still more concerns about the "brokenness" of emacsclient right now :)

With minor adjustments, emacs compiles. But there are problems:

1) emacs -f server-start with server-use-tcp set to off throws an error
  (cannot bind to socket: address already in use). If server-use-tcp is
  enabled, the error disappears - so "old-style" local socket use is
  currently broken.

2) emacsclient fails to find the TCP-based server by default; this is because of

HSOCKET
set_socket ()
{
 if (server_file)
   return set_tcp_socket ();
 else
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
   return set_local_socket ();
#else
   {
     server_file = "server";
     return set_tcp_socket ();
   }
#endif
}

Because linux has file system sockets, the default server_file
(server) is never tried.
Would it make sense to change this to

HSOCKET
set_socket ()
{
HSOCKET result = INVALID_SOCKET;
 if (server_file == NULL)
   server_file = "server";
 result = set_tcp_socket ();
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
 if (result == INVALID_SOCKET)
   return set_local_socket ();
#endif
 return result;
}

instead?  That way the TCP connection is tried without having to
specifically say -f server. Also, since there is no file-based socket
created, the 'connection refused' is not the most helpful error.

3) If the O_NONBLOCK flag actually gets set on the socket, emacslient
   no longer works - emacs gets the request, opens the file, then immediately
   closes it again (presumably because the client is gone). This does not
   happen when the O_NONBLOCK/O_NDELAY flag is not set on the socket
   (the FIONBIO ioctl seems to be a no-op in this regard).  Removing all the
   fcntls and ioctls, things work normally - so is the non-blocking thing
   actually needed?

So there are two patches attached; socket-stuff.patch is a version of my
previous patch, that adds the filio.h check (and corrects the code to use fcntl
rather than ioctl to set O_NONBLOCK/O_NDELAY) - but this seems to break
emacsclient (note that this patch only contains configure.in, not the changes
resulting from autoreconf, because debian uses autoconf 2.60a; and as an
aside, with that autoconf version, config.status warns about two Makefile.ins
potentially not respecting --datarootdir). The other patch, no-nonblock.patch
removes the fcntls/ioctls from emacsclient.c entirely.

Attachment: socket-stuff.patch
Description: Binary data

Attachment: no-nonblock.patch
Description: Binary data


reply via email to

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