* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
@ 2016-05-23 20:34 Ken Brown
2016-05-23 20:57 ` Glenn Morris
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Ken Brown @ 2016-05-23 20:34 UTC (permalink / raw)
To: 23606
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":
diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el
index c9b7cc7..80f6b9c 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -143,7 +143,7 @@ server-process-filter
(port (aref (process-contact server :local) 4))
(proc (make-network-process :name "foo"
:buffer (generate-new-buffer "*foo*")
- :host "localhost"
+ :host "127.0.0.1"
:nowait t
:service port)))
(should (eq (process-status proc) 'connect))
Further investigation shows that if "localhost" is used, then the
connection fails with ECONNREFUSED when the first addrinfo returned by
getaddrinfo is used, but it succeeds with the second. Since the client
socket is nonblocking in the test under discussion, the loop through the
addrinfos never gets to try the second one.
I notice that there are a couple of places in process.c where the code
makes a point of using "127.0.0.1" instead of "localhost", so I wonder
if we should just patch the test to do the same. Or do experts think
it's worth pursuing this further to find out why it makes a difference
on Cygwin?
In GNU Emacs 25.1.50.23 (x86_64-unknown-cygwin, GTK+ Version 3.18.9)
of 2016-05-23 built on desktop-new
Repository revision: d5f42ab6f06e1d468c6b92f2c1ef7b4d5f97ff84
Windowing system distributor 'The Cygwin/X Project', version 11.0.11802000
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --with-modules 'CFLAGS=-g3 -O0''
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message puny seq byte-opt gv bytecomp
byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache
epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)
^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
2016-05-23 20:34 bug#23606: 25.1.50; "localhost" vs. "127.0.0.1" Ken Brown
@ 2016-05-23 20:57 ` Glenn Morris
2016-05-23 21:00 ` Lars Ingebrigtsen
2016-05-24 17:20 ` Achim Gratz
2 siblings, 0 replies; 9+ messages in thread
From: Glenn Morris @ 2016-05-23 20:57 UTC (permalink / raw)
To: Ken Brown; +Cc: 23606
Ken Brown wrote:
> 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":
I see the same thing on RHEL 7.2, so this isn't Cygwin-specific.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
2016-05-23 20:34 bug#23606: 25.1.50; "localhost" vs. "127.0.0.1" Ken Brown
2016-05-23 20:57 ` Glenn Morris
@ 2016-05-23 21:00 ` Lars Ingebrigtsen
2016-05-23 22:30 ` Glenn Morris
2016-05-24 17:20 ` Achim Gratz
2 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2016-05-23 21:00 UTC (permalink / raw)
To: Ken Brown; +Cc: 23606
Ken Brown <kbrown@cornell.edu> 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":
If it doesn't work on Cygwin, then perhaps the test should just be
disabled there.
> - :host "localhost"
> + :host "127.0.0.1"
There's one test for "localhost" and one for "127.0.0.1", and the point
of those tests are to test whether name resolution works, and to test
that connecting with an IP address works.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
2016-05-23 21:00 ` Lars Ingebrigtsen
@ 2016-05-23 22:30 ` Glenn Morris
2016-05-24 15:47 ` Lars Ingebrigtsen
0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2016-05-23 22:30 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 23606
Lars Ingebrigtsen wrote:
> If it doesn't work on Cygwin, then perhaps the test should just be
> disabled there.
It's not just Cygwin.
> There's one test for "localhost" and one for "127.0.0.1", and the point
> of those tests are to test whether name resolution works, and to test
> that connecting with an IP address works.
I think you mean echo-server-with-localhost and echo-server-with-ip?
Both those tests pass for me on RHEL 7.2.
This report is about echo-server-nowait, which fails if "localhost" is
used, for reasons that seem to be unrelated to what the test is actually
supposed to be for.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
2016-05-23 22:30 ` Glenn Morris
@ 2016-05-24 15:47 ` Lars Ingebrigtsen
0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2016-05-24 15:47 UTC (permalink / raw)
To: Glenn Morris; +Cc: 23606
Glenn Morris <rgm@gnu.org> writes:
> I think you mean echo-server-with-localhost and echo-server-with-ip?
> Both those tests pass for me on RHEL 7.2.
Ah, then it's probably OK to use the IP address in this test:
> This report is about echo-server-nowait, which fails if "localhost" is
> used, for reasons that seem to be unrelated to what the test is actually
> supposed to be for.
It does sound like a bug that it doesn't work, though, but that should
perhaps be a separate bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
2016-05-23 20:34 bug#23606: 25.1.50; "localhost" vs. "127.0.0.1" Ken Brown
2016-05-23 20:57 ` Glenn Morris
2016-05-23 21:00 ` Lars Ingebrigtsen
@ 2016-05-24 17:20 ` Achim Gratz
2016-05-24 18:35 ` Ken Brown
2 siblings, 1 reply; 9+ messages in thread
From: Achim Gratz @ 2016-05-24 17:20 UTC (permalink / raw)
To: 23606
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.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#23606: 25.1.50; "localhost" vs. "127.0.0.1"
2016-05-24 17:20 ` Achim Gratz
@ 2016-05-24 18:35 ` Ken Brown
2016-05-24 19:19 ` Glenn Morris
0 siblings, 1 reply; 9+ messages in thread
From: Ken Brown @ 2016-05-24 18:35 UTC (permalink / raw)
To: Achim Gratz, 23606; +Cc: Lars Magne Ingebrigtsen
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-05-24 19:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-23 20:34 bug#23606: 25.1.50; "localhost" vs. "127.0.0.1" Ken Brown
2016-05-23 20:57 ` Glenn Morris
2016-05-23 21:00 ` Lars Ingebrigtsen
2016-05-23 22:30 ` Glenn Morris
2016-05-24 15:47 ` Lars Ingebrigtsen
2016-05-24 17:20 ` Achim Gratz
2016-05-24 18:35 ` Ken Brown
2016-05-24 19:19 ` Glenn Morris
2016-05-24 19:57 ` Ken Brown
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).