From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#23658: 25.1.50; make-network-connection fails to connect to IPv6 address on Windows Date: Thu, 2 Jun 2016 10:50:19 -0400 Message-ID: References: <87d1o3yty2.fsf@gmail.com> <240c188a-bfeb-a8f6-2e6d-fe6c90e37072@cornell.edu> <36e6ff49-8a24-b973-048f-c27fe58c7f93@cornell.edu> <778c3c88-8eb0-d54c-e00a-84165f5c63b5@cornell.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1464879085 5610 80.91.229.3 (2 Jun 2016 14:51:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 14:51:25 +0000 (UTC) Cc: Lars Magne Ingebrigtsen , 23658@debbugs.gnu.org To: Fran Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 16:51:14 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b8Txq-0007gk-4g for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 16:51:14 +0200 Original-Received: from localhost ([::1]:47616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Txo-0001ib-T2 for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 10:51:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Txj-0001iW-8z for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2016 10:51:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8Txe-0008EA-0q for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2016 10:51:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Txd-0008E6-T9 for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2016 10:51:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b8Txd-0004L0-JL for bug-gnu-emacs@gnu.org; Thu, 02 Jun 2016 10:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Jun 2016 14:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23658 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23658-submit@debbugs.gnu.org id=B23658.146487903216637 (code B ref 23658); Thu, 02 Jun 2016 14:51:01 +0000 Original-Received: (at 23658) by debbugs.gnu.org; 2 Jun 2016 14:50:32 +0000 Original-Received: from localhost ([127.0.0.1]:51878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8TxA-0004KH-Hn for submit@debbugs.gnu.org; Thu, 02 Jun 2016 10:50:32 -0400 Original-Received: from limerock03.mail.cornell.edu ([128.84.13.243]:35201) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Tx8-0004K4-Kn for 23658@debbugs.gnu.org; Thu, 02 Jun 2016 10:50:31 -0400 X-CornellRouted: This message has been Routed already. Original-Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock03.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u52EoOpM019731; Thu, 2 Jun 2016 10:50:24 -0400 Original-Received: from [192.168.1.3] (mta-68-175-148-36.twcny.rr.com [68.175.148.36] (may be forged)) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id u52EoLY4019790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 2 Jun 2016 10:50:22 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 In-Reply-To: <778c3c88-8eb0-d54c-e00a-84165f5c63b5@cornell.edu> X-PMX-Cornell-Gauge: Gauge=XXXXX X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118978 Archived-At: On 6/1/2016 5:55 PM, Ken Brown wrote: > On 6/1/2016 3:57 PM, Fran wrote: >> Removing the ":nowait t" makes it connect successfully to the IPv6 >> address. In that case, it works regardless of whether ":family 'ipv6" >> is present. If this were my personal code that would be a sufficient >> workaround, but I found this bug in ERC (the Emacs IRC client), and I >> think it is designed so that make-network-process has to connect >> asynchronously. > > This sounds similar to the situation I faced in bug#23606. (But in that > case specifying :family solved the problem). Here's what I suspect is > happening: > > In src/process.c there's a loop starting at line 3138 in which the code > runs through a list of possible addrinfo structures in the hopes of > finding one it can connect to. In the asynchronous case, it doesn't > wait to see if the connection is successful; this is only discovered > later (around line 5495). At this point it's too late to try another > addrinfo structure, and a "failed" message is generated (line 5523) if > the connection didn't succeed. While we're waiting for an expert to respond to this, it's easy to test if my guess is correct. Please apply the following patch, rebuild, and retry your tests. diff --git a/src/process.c b/src/process.c index 9ca3e594..30a200f 100644 --- a/src/process.c +++ b/src/process.c @@ -3135,6 +3135,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, count1 = SPECPDL_INDEX (); s = -1; + int addrinfo_count = 0; while (!NILP (addrinfos)) { Lisp_Object addrinfo = XCAR (addrinfos); @@ -3142,6 +3143,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, int protocol = XINT (XCAR (addrinfo)); Lisp_Object ip_address = XCDR (addrinfo); + message ("Trying addrinfo structure %d", ++addrinfo_count); + #ifdef WINDOWSNT retry_connect: #endif This will print a message in the echo area (and the *Messages* buffer) on each iteration of the loop. If my guess is correct, you should see more than one iteration in the IPv6 case if ":nowait t" is removed. It would also be interesting to see if ":family 'ipv6" has any effect, again without ":nowait t". Ken