Subject: Re: bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"

From: Ken Brown <[email-masked]>
Date: Tue, 24 May 2016 14:35:17 -0400

On 5/24/2016 1:20 PM, Achim Gratz wrote:
> Ken Brown writes:
>> The test echo-server-nowait in test/lisp/net/network-stream-tests.el
>> fails on Cygwin, but it passes if I create the client process using
>> "127.0.0.1" instead of "localhost":
> 
> This could be a case where it makes a difference if the IPv6 (::1) or
> IPv4 address is returned (first) for localhost.  IIRC, Windows and
> up-to-date Linux prefer IPv6 by default.  If so, it would likely be
> better to fix the parts of the code that assumes return of IPv4
> addresses only.

You're right.  In the test in question, IPv4 is specified for the server but not for the client.  The test passes on Cygwin if I specify IPv4 for the client also:

diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el
index c9b7cc7..f30c92a 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -145,6 +145,7 @@ server-process-filter
                                      :buffer (generate-new-buffer "*foo*")
                                      :host "localhost"
                                      :nowait t
+                                     :family 'ipv4
                                      :service port)))
     (should (eq (process-status proc) 'connect))
     (while (eq (process-status proc) 'connect)

Glenn, does this also fix the problem on RHEL 7.2?

Ken