GNU bug report logs - #6781
emacs server with X11 build on OSX

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Mon, 2 Aug 2010 20:23:02 UTC

Severity: normal

Done: Juanma Barranquero <lekktu <at> gmail.com>

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 6781 in the body.
You can then email your comments to 6781 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#6781; Package emacs. (Mon, 02 Aug 2010 20:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 02 Aug 2010 20:23:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Mon, 2 Aug 2010 22:22:05 +0200
(I'm Cc:ing this to bug-gnu-emacs to create a bug report.)

On Mon, Aug 2, 2010 at 17:56, Leo <sdl.web <at> gmail.com> wrote:

>> (make-network-process :name "server" :server t :family nil :service t
>> :host 'local)

> I have used the following in server-start as workaround:
>
>  (make-network-process :name "server" :server t :family 'ipv4 :service t)

If ":family 'ipv4" works and ":family nil" does not, that surely means
that Emacs is chosing ipv6. Does server.el work with the attached
patch?

I don't know whether that means that your system is set up only for
ipv6, or that it has both ipv6 and ipv4 and make-network-process is
selecting ipv6 for `localhost'. In any case, server.el / emacsclient.c
are not adapted to ipv6, so forcing ipv4 seems right for the moment
being.

    Juanma



=== modified file 'lisp/server.el'
--- lisp/server.el	2010-05-29 23:50:47 +0000
+++ lisp/server.el	2010-08-02 20:16:16 +0000
@@ -564,5 +564,5 @@
 		       ;; The other args depend on the kind of socket used.
 		       (if server-use-tcp
-			   (list :family nil
+			   (list :family 'ipv4
 				 :service t
 				 :host (or server-host 'local)




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

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

From: Leo <sdl.web <at> gmail.com>
To: 6781 <at> debbugs.gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Mon, 02 Aug 2010 23:16:53 +0100
,----
| (make-network-process :name "server" :server t :family 'ipv4 :service t :host 'local).
`----

Fails with backtrace:
,----
| Debugger entered--Lisp error: (error "localhost/0 nodename nor servname provided, or not known")
|   make-network-process(:name "server" :server t :family ipv4 :service t :host local)
|   eval((make-network-process :name "server" :server t :family (quote ipv4) :service t :host (quote local)))
|   eval-last-sexp-1(nil)
|   eval-last-sexp(nil)
|   call-interactively(eval-last-sexp nil nil)
`----

and
,----
| (make-network-process :name "server" :server t :family 'ipv4 :service t :host "localhost")
`----
fails in the same way.

However, the following works:
,----
| (make-network-process :name "server" :server t :family 'ipv4 :service t :host "127.0.0.1")
`----


`ping localhost' in terminal shows:
,----
| leo <at> Victoria ~$ ping localhost
| PING localhost (127.0.0.1): 56 data bytes
| 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.041 ms
| 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.049 ms
`----

Leo




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

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

From: Ken Raeburn <raeburn <at> raeburn.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>, Leo <sdl.web <at> gmail.com>,
	emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Mon, 2 Aug 2010 22:12:29 -0400
On Aug 2, 2010, at 16:22, Juanma Barranquero wrote:

> (I'm Cc:ing this to bug-gnu-emacs to create a bug report.)
> 
> On Mon, Aug 2, 2010 at 17:56, Leo <sdl.web <at> gmail.com> wrote:
> 
>>> (make-network-process :name "server" :server t :family nil :service t
>>> :host 'local)
> 
>> I have used the following in server-start as workaround:
>> 
>>  (make-network-process :name "server" :server t :family 'ipv4 :service t)
> 
> If ":family 'ipv4" works and ":family nil" does not, that surely means
> that Emacs is chosing ipv6. Does server.el work with the attached
> patch?

There was one more difference, which was that your suggestion included ":host 'local" and his workaround did not.

Using ":host 'local" causes the C code to look up the name "localhost", which may or may not map to IPv4 and/or IPv6 addresses.  (Almost always an IPv4 address of 127.0.0.1; sometimes IPv6 also, and I've occasionally seen it mapped to the local ethernet interface's IPv4 address.)  Not specifying the host at all causes a wildcard address to be used, which would be reachable from other hosts, whereas 127.0.0.1 generally is not.  (Actually, in the version I'm looking at, which isn't quite current, it causes INADDR_ANY to be used, which looks like a bug if the address family is not specifically given as AF_INET.  I'll try to look at that a little closer if I get some time next weekend.)

> I don't know whether that means that your system is set up only for
> ipv6, or that it has both ipv6 and ipv4 and make-network-process is
> selecting ipv6 for `localhost'. In any case, server.el / emacsclient.c
> are not adapted to ipv6, so forcing ipv4 seems right for the moment
> being.

Yes.

Ken



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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Ken Raeburn <raeburn <at> raeburn.org>
Cc: 6781 <at> debbugs.gnu.org, Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 3 Aug 2010 04:47:57 +0200
On Tue, Aug 3, 2010 at 04:12, Ken Raeburn <raeburn <at> raeburn.org> wrote:

> Using ":host 'local" causes the C code to look up the name "localhost",
> which may or may not map to IPv4 and/or IPv6 addresses.  (Almost
> always an IPv4 address of 127.0.0.1; sometimes IPv6 also, and I've
> occasionally seen it mapped to the local ethernet interface's IPv4
> address.)  Not specifying the host at all causes a wildcard address to
> be used, which would be reachable from other hosts, whereas
> 127.0.0.1 generally is not.

[Ah, the wonders of TCP.]

I think you're right, because in Leo's examples it works when he
specifically sets "127.0.0.1", so it's clear that Emacs isn't
selecting that address with "localhost" or 'local. I suppose the Right
Thing to do for server.el is to force it to use "127.0.0.1" instead of
'local for the :host argument.

    Juanma


=== modified file 'lisp/server.el'
--- lisp/server.el	2010-01-13 08:35:10 +0000
+++ lisp/server.el	2010-08-03 02:44:17 +0000
@@ -561,7 +561,7 @@
 		       ;; The other args depend on the kind of socket used.
 		       (if server-use-tcp
-			   (list :family nil
+			   (list :family 'ipv4
 				 :service t
-				 :host (or server-host 'local)
+				 :host (or server-host "127.0.0.1") ;; bug#6781
 				 :plist '(:authenticated nil))
 			 (list :family 'local




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

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

From: Leo <sdl.web <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 03 Aug 2010 06:01:49 +0100
On 2010-08-03 03:47 +0100, Juanma Barranquero wrote:
> I think you're right, because in Leo's examples it works when he
> specifically sets "127.0.0.1", so it's clear that Emacs isn't
> selecting that address with "localhost" or 'local. I suppose the Right
> Thing to do for server.el is to force it to use "127.0.0.1" instead of
> 'local for the :host argument.
>
>     Juanma
[...]

I think this can be the workaround for now while waiting for Ken to look
at the C side for more bugs there. Thank you both.

Could you also simplify (more readable) the loop in server-start like
this:

diff --git a/lisp/server.el b/lisp/server.el
index 1042bee..bd0d62b 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -572,11 +572,11 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
 	  (when server-use-tcp
 	    (let ((auth-key
 		   (loop
-		      ;; The auth key is a 64-byte string of random chars in the
-		      ;; range `!'..`~'.
-		      for i below 64
-		      collect (+ 33 (random 94)) into auth
-		      finally return (concat auth))))
+		    ;; The auth key is a 64-byte string of random chars in the
+		    ;; range `!'..`~'.
+		    repeat 64
+		    collect (+ 33 (random 94)) into auth
+		    finally return (concat auth))))
 	      (process-put server-process :auth-key auth-key)
 	      (with-temp-file server-file
 		(set-buffer-multibyte nil)

Leo




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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 3 Aug 2010 14:02:19 +0200
On Tue, Aug 3, 2010 at 07:01, Leo <sdl.web <at> gmail.com> wrote:

> On 2010-08-03 03:47 +0100, Juanma Barranquero wrote:
>> I suppose the Right
>> Thing to do for server.el is to force it to use "127.0.0.1" instead of
>> 'local for the :host argument.

> I think this can be the workaround for now while waiting for Ken to look
> at the C side for more bugs there. Thank you both.

I meant that server.el should stick to IPv4 and make sure it does so,
not that it was the fix for your problem.

If you ping localhost and it reaches 127.0.0.1, but
(make-network-proces ... :host 'local) does not use that address, it
is obvious there's a bug somewhere...

> Could you also simplify (more readable) the loop in server-start like this:

> -                     for i below 64
> +                   repeat 64

Nice. I wonder why did I miss "repeat".

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6781; Package emacs. (Tue, 03 Aug 2010 12:45:03 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 03 Aug 2010 14:44:51 +0200
Juanma Barranquero <lekktu <at> gmail.com> writes:

> If you ping localhost and it reaches 127.0.0.1, but

ping probably does not use getaddrinfo, but the older gethostbyname
(which does not properly support IPv6).

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 3 Aug 2010 14:48:32 +0200
On Tue, Aug 3, 2010 at 14:44, Andreas Schwab <schwab <at> linux-m68k.org> wrote:

> ping probably does not use getaddrinfo, but the older gethostbyname
> (which does not properly support IPv6).

Still a problem, isn't it?

    Juanma




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

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 03 Aug 2010 15:01:15 +0200
Juanma Barranquero <lekktu <at> gmail.com> writes:

> On Tue, Aug 3, 2010 at 14:44, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
>
>> ping probably does not use getaddrinfo, but the older gethostbyname
>> (which does not properly support IPv6).
>
> Still a problem, isn't it?

gethostbyname works quite different from getaddrinfo.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 3 Aug 2010 15:03:08 +0200
On Tue, Aug 3, 2010 at 15:01, Andreas Schwab <schwab <at> linux-m68k.org> wrote:

> gethostbyname works quite different from getaddrinfo.

Still a problem that (make-network-process ... :host 'local) fails.
Something's obviously not right.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6781; Package emacs. (Wed, 04 Aug 2010 00:53:02 GMT) Full text and rfc822 format available.

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

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Andreas Schwab <schwab <at> linux-m68k.org>, Leo <sdl.web <at> gmail.com>,
	emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Wed, 04 Aug 2010 09:52:23 +0900
>>>>> On Tue, 3 Aug 2010 15:03:08 +0200, Juanma Barranquero <lekktu <at> gmail.com> said:

> On Tue, Aug 3, 2010 at 15:01, Andreas Schwab <schwab <at> linux-m68k.org>
> wrote:
>> gethostbyname works quite different from getaddrinfo.

> Still a problem that (make-network-process ... :host 'local) fails.
> Something's obviously not right.

I suspect there is a bug in getaddrinfo on Mac OS X 10.6.4.  At least,
the behavior of the following program is incompatible with that on Mac
OS X 10.5.8.

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

main ()
{
  struct addrinfo hints, *res;
  char *servnames[] = {"0", "1", NULL};
  int error, i;

  memset (&hints, 0, sizeof (hints));
  hints.ai_family = PF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  for (i = 0; i < sizeof (servnames) / sizeof (servnames[0]); i++)
    {
      if (servnames[i])
	printf ("servname = \"%s\":\n", servnames[i]);
      else
	printf ("servname = (null):\n");
      error = getaddrinfo ("localhost", servnames[i], &hints, &res);
      if (error != 0)
	puts (gai_strerror (error));
      else
	{
	  struct addrinfo *r;

	  for (r = res; r; r = r->ai_next)
	    {
	      printf ("family = %d, socktype = %d, protocol = %d\n",
		      r->ai_family, r->ai_socktype, r->ai_protocol);
	    }
	  freeaddrinfo (res);
	}
      puts ("");
    }
}

*** Mac OS X 10.6.4 ***
servname = "0":
nodename nor servname provided, or not known

servname = "1":
family = 30, socktype = 1, protocol = 6
family = 30, socktype = 1, protocol = 6
family = 2, socktype = 1, protocol = 6

servname = (null):
family = 30, socktype = 1, protocol = 6
family = 30, socktype = 1, protocol = 6
family = 2, socktype = 1, protocol = 6


*** Mac OS X 10.5.8 ***
servname = "0":
family = 30, socktype = 1, protocol = 6
family = 30, socktype = 1, protocol = 6
family = 2, socktype = 1, protocol = 6

servname = "1":
family = 30, socktype = 1, protocol = 6
family = 30, socktype = 1, protocol = 6
family = 2, socktype = 1, protocol = 6

servname = (null):
family = 30, socktype = 1, protocol = 6
family = 30, socktype = 1, protocol = 6
family = 2, socktype = 1, protocol = 6


Actually, one can find a major rewrite in getaddrinfo's
implementation.  (Libinfo in
http://opensource.apple.com/release/mac-os-x-1064/ and
http://opensource.apple.com/release/mac-os-x-1058/ )

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6781; Package emacs. (Wed, 04 Aug 2010 15:26:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 6781 <at> debbugs.gnu.org,
	emacs-devel <at> gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Andreas Schwab <schwab <at> linux-m68k.org>, Leo <sdl.web <at> gmail.com>
Subject: Re: bug#6781: emacs server with X11 build on OSX
Date: Wed, 04 Aug 2010 11:25:53 -0400
YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> writes:

> I suspect there is a bug in getaddrinfo on Mac OS X 10.6.4.  At least,
> the behavior of the following program is incompatible with that on Mac
> OS X 10.5.8.

Could you write a PROBLEMS entry about your discovery?




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

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Wed, 04 Aug 2010 15:18:16 +0200
> -			   (list :family nil
> +			   (list :family 'ipv4

That would make sense if emacsclient.c only supports ipv4.  Not being
up-to-speed on ipv6, I do not know whether that's the case.

> -				 :host (or server-host 'local)
> +				 :host (or server-host "127.0.0.1") ;; bug#6781

We should rather do that in the C code of make-network-process, where
instead of "localhost" we might prefer using "127.0.0.1".


        Stefan




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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Thu, 5 Aug 2010 11:02:59 +0200
On Wed, Aug 4, 2010 at 15:18, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> That would make sense if emacsclient.c only supports ipv4.  Not being
> up-to-speed on ipv6, I do not know whether that's the case.

It is right now, at least because there are a few hardcoded 127.0.0.1.

> We should rather do that in the C code of make-network-process, where
> instead of "localhost" we might prefer using "127.0.0.1".

Wouldn't that run counter to adapting to IPv6?

    Juanma




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

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Mon, 09 Aug 2010 13:24:12 +0200
>> That would make sense if emacsclient.c only supports ipv4.  Not being
>> up-to-speed on ipv6, I do not know whether that's the case.
> It is right now, at least because there are a few hardcoded 127.0.0.1.

OK.

>> We should rather do that in the C code of make-network-process, where
>> instead of "localhost" we might prefer using "127.0.0.1".
> Wouldn't that run counter to adapting to IPv6?

Could be, but if the workaround is needed for server.el, I can't see why
it would not be needed for other (IPv4) uses of make-network-process.


        Stefan




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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Mon, 9 Aug 2010 19:08:44 +0200
On Mon, Aug 9, 2010 at 13:24, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> Could be, but if the workaround is needed for server.el, I can't see why
> it would not be needed for other (IPv4) uses of make-network-process.

You're right, but at the moment we haven't received any other
complain, and it's equally possible that changing it will break
someone's code that works right now.

But, all in all, I agree that if `localhost' can be interpreted as
variably as Ken has pointed out, we shouldn't use it.

    Juanma




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

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 10 Aug 2010 15:31:00 +0200
>> Could be, but if the workaround is needed for server.el, I can't see why
>> it would not be needed for other (IPv4) uses of make-network-process.
> You're right, but at the moment we haven't received any other
> complain, and it's equally possible that changing it will break
> someone's code that works right now.

For Emacs-24's code, it's OK because we have a fair bit of time to test it.

> But, all in all, I agree that if `localhost' can be interpreted as
> variably as Ken has pointed out, we shouldn't use it.

Could you make the corresponding change in `trunk'?


        Stefan




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

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: emacs server with X11 build on OSX
Date: Tue, 10 Aug 2010 20:31:02 +0200
On Tue, Aug 10, 2010 at 15:31, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> Could you make the corresponding change in `trunk'?

Not now. I'm in a hotel, with spotty and not very secure internet
access and a slooooow EeePC; hardly the time to hack Emacs :-(

I'll work on it after Aug, 18 if no one beats me.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6781; Package emacs. (Fri, 24 Sep 2010 19:37:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: bug#6781: emacs server with X11 build on OSX
Date: Fri, 24 Sep 2010 21:38:28 +0200
On Tue, Aug 10, 2010 at 15:31, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>
>> But, all in all, I agree that if `localhost' can be interpreted as
>> variably as Ken has pointed out, we shouldn't use it.
>
> Could you make the corresponding change in `trunk'?

OK to this change, then?

    Juanma



2010-09-24  Juanma Barranquero	<lekktu <at> gmail.com>

	* server.el (server-start): Revert part of 2010-08-08 change.  Using
	address 127.0.0.1 for local host is now done in Fmake_network_process.

2010-09-24  Juanma Barranquero	<lekktu <at> gmail.com>

	* process.c (Fmake_network_process): When arg :host is 'local,
	use address 127.0.0.1, not name "localhost".  (Bug#6781)


=== modified file 'lisp/server.el'
--- lisp/server.el	2010-08-26 13:46:19 +0000
+++ lisp/server.el	2010-09-24 19:16:01 +0000
@@ -565,7 +565,7 @@
 		       (if server-use-tcp
 			   (list :family 'ipv4  ;; We're not ready for IPv6 yet
 				 :service t
-				 :host (or server-host "127.0.0.1") ;; See bug#6781
+				 :host (or server-host 'local)
 				 :plist '(:authenticated nil))
 			 (list :family 'local
 			       :service server-file

=== modified file 'src/process.c'
--- src/process.c	2010-09-17 15:47:49 +0000
+++ src/process.c	2010-09-24 19:31:13 +0000
@@ -3170,7 +3170,9 @@
   if (!NILP (host))
     {
       if (EQ (host, Qlocal))
-	host = build_string ("localhost");
+	/* Depending on setup, "localhost" may map to different IPv4 and/or
+	   IPv6 addresses, so it's better to be explicit.  (Bug#6781) */
+	host = build_string ("127.0.0.1");
       CHECK_STRING (host);
     }




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6781; Package emacs. (Fri, 24 Sep 2010 22:26:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6781 <at> debbugs.gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Leo <sdl.web <at> gmail.com>, emacs-devel <at> gnu.org
Subject: Re: bug#6781: emacs server with X11 build on OSX
Date: Sat, 25 Sep 2010 00:27:54 +0200
>>> But, all in all, I agree that if `localhost' can be interpreted as
>>> variably as Ken has pointed out, we shouldn't use it.
>> Could you make the corresponding change in `trunk'?
> OK to this change, then?

Looks OK, thanks,


        Stefan





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6781; Package emacs. (Sat, 25 Sep 2010 03:55:01 GMT) Full text and rfc822 format available.

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

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 6781 <at> debbugs.gnu.org,
	emacs-devel <at> gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Andreas Schwab <schwab <at> linux-m68k.org>, Leo <sdl.web <at> gmail.com>
Subject: Re: bug#6781: emacs server with X11 build on OSX
Date: Sat, 25 Sep 2010 12:57:23 +0900
>>>>> On Wed, 04 Aug 2010 11:25:53 -0400, Chong Yidong <cyd <at> stupidchicken.com> said:

> YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> writes:
>> I suspect there is a bug in getaddrinfo on Mac OS X 10.6.4.  At
>> least, the behavior of the following program is incompatible with
>> that on Mac OS X 10.5.8.

> Could you write a PROBLEMS entry about your discovery?

I think it is more natural to specify NULL for the unspecified port
case, and it also works as a workaround.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp

=== modified file 'src/process.c'
*** src/process.c	2010-06-03 22:47:35 +0000
--- src/process.c	2010-09-25 03:52:03 +0000
***************
*** 3446,3452 ****
        /* SERVICE can either be a string or int.
  	 Convert to a C string for later use by getaddrinfo.  */
        if (EQ (service, Qt))
! 	portstring = "0";
        else if (INTEGERP (service))
  	{
  	  sprintf (portbuf, "%ld", (long) XINT (service));
--- 3446,3455 ----
        /* SERVICE can either be a string or int.
  	 Convert to a C string for later use by getaddrinfo.  */
        if (EQ (service, Qt))
! 	/* We pass NULL for unspecified port, because some versions of
! 	   Darwin return EAI_NONAME for getaddrinfo ("localhost", "0",
! 	   ...).  */
! 	portstring = NULL;
        else if (INTEGERP (service))
  	{
  	  sprintf (portbuf, "%ld", (long) XINT (service));
***************
*** 3472,3482 ****
  
        ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
        if (ret)
  #ifdef HAVE_GAI_STRERROR
! 	error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret));
  #else
! 	error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret);
  #endif
        immediate_quit = 0;
  
        goto open_socket;
--- 3475,3493 ----
  
        ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
        if (ret)
+ 	{
  #ifdef HAVE_GAI_STRERROR
! 	  if (portstring)
! 	    error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret));
! 	  else
! 	    error ("%s %s", SDATA (host), gai_strerror(ret));
  #else
! 	  if (portstring)
! 	    error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret);
! 	  else
! 	    error ("%s getaddrinfo error %d", SDATA (host), ret);
  #endif
+ 	}
        immediate_quit = 0;
  
        goto open_socket;





Reply sent to Juanma Barranquero <lekktu <at> gmail.com>:
You have taken responsibility. (Mon, 27 Sep 2010 12:11:02 GMT) Full text and rfc822 format available.

Notification sent to Juanma Barranquero <lekktu <at> gmail.com>:
bug acknowledged by developer. (Mon, 27 Sep 2010 12:11:02 GMT) Full text and rfc822 format available.

Message #70 received at 6781-done <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 6781-done <at> debbugs.gnu.org,
	emacs-devel <at> gnu.org, Ken Raeburn <raeburn <at> raeburn.org>,
	Andreas Schwab <schwab <at> linux-m68k.org>, Leo <sdl.web <at> gmail.com>
Subject: Re: bug#6781: emacs server with X11 build on OSX
Date: Mon, 27 Sep 2010 14:12:12 +0200
On Sat, Sep 25, 2010 at 05:57, YAMAMOTO Mitsuharu
<mituharu <at> math.s.chiba-u.ac.jp> wrote:
>>>>>> On Wed, 04 Aug 2010 11:25:53 -0400, Chong Yidong <cyd <at> stupidchicken.com> said:
>
>> YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> writes:
>>> I suspect there is a bug in getaddrinfo on Mac OS X 10.6.4.  At
>>> least, the behavior of the following program is incompatible with
>>> that on Mac OS X 10.5.8.
>
>> Could you write a PROBLEMS entry about your discovery?
>
> I think it is more natural to specify NULL for the unspecified port
> case, and it also works as a workaround.

That is another bug. I'm closing this one.

I suggest either commiting your fix, if appropriate, or filing a new
bug report with your patch so it can be discussed.

    Juanma




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 26 Oct 2010 11:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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