From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#34134: 27.0.50; process-contact for accepted sockets broken Date: Wed, 30 Jan 2019 15:13:51 -0800 Organization: UCLA Computer Science Department Message-ID: <6edec1e6-bbbb-f55a-6b95-a5c068d91a35@cs.ucla.edu> References: <837eet6tyz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------FF28FD76AE92DB6CAE68E0B1" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="192008"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 Cc: 34134-done@debbugs.gnu.org To: Eli Zaretskii , Mathew Handugan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 31 00:14:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goz3c-000noQ-I0 for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Jan 2019 00:14:12 +0100 Original-Received: from localhost ([127.0.0.1]:45527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goz3b-0001IA-IX for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jan 2019 18:14:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goz3U-0001Ho-Iu for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2019 18:14:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goz3T-0004y0-KZ for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2019 18:14:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52742) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goz3T-0004xo-EH for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2019 18:14:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1goz3T-0001Aj-3g for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2019 18:14:03 -0500 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jan 2019 23:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 34134 X-GNU-PR-Package: emacs Mail-Followup-To: 34134@debbugs.gnu.org, eggert@cs.ucla.edu, mathew@handugan.com Original-Received: via spool by 34134-done@debbugs.gnu.org id=D34134.15488900414486 (code D ref 34134); Wed, 30 Jan 2019 23:14:02 +0000 Original-Received: (at 34134-done) by debbugs.gnu.org; 30 Jan 2019 23:14:01 +0000 Original-Received: from localhost ([127.0.0.1]:52023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goz3Q-0001AI-K2 for submit@debbugs.gnu.org; Wed, 30 Jan 2019 18:14:00 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goz3O-0001A5-H6 for 34134-done@debbugs.gnu.org; Wed, 30 Jan 2019 18:13:59 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0238A161095; Wed, 30 Jan 2019 15:13:53 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 4KNkwtRWdCLW; Wed, 30 Jan 2019 15:13:52 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1089C16112F; Wed, 30 Jan 2019 15:13:52 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4YUrt0aFfovh; Wed, 30 Jan 2019 15:13:51 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C91E8161092; Wed, 30 Jan 2019 15:13:51 -0800 (PST) Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQABzSBQYXVsIEVnZ2Vy dCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PsLBfgQTAQIAKAUCTIByZAIbAwUJEswDAAYLCQgHAwIG FQgCCQoLBBYCAwECH In-Reply-To: <837eet6tyz.fsf@gnu.org> Content-Language: en-US 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: 209.51.188.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:154916 Archived-At: This is a multi-part message in MIME format. --------------FF28FD76AE92DB6CAE68E0B1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 1/25/19 12:07 AM, Eli Zaretskii wrote: >> From: Mathew Handugan >> Date: Fri, 18 Jan 2019 22:52:41 -0800 >> >> Git commit be9e60fc3c43cc49cc5d749924c3e96737ae297c causes accepted sockets to store 't as :host >> instead of the string-formatted peer IP address. >> >> This manifests as >> (process-contact proc) >> returning something like >> (t 55269) >> >> instead of the expected: >> ("192.168.2.13" 55269) > Thanks. Paul, could you please take a look at this? Thanks for reporting the bug, especially the test case. I reproduce the problem and fixed it by installing the attached patch into the emacs-26 branch on Savannah. --------------FF28FD76AE92DB6CAE68E0B1 Content-Type: text/x-patch; name="0001-Fix-process-contact-bug-with-TCP-connections.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-process-contact-bug-with-TCP-connections.patch" >From 16d92c9748fe0eb75ec20a1117700525538b5bd0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 30 Jan 2019 15:11:17 -0800 Subject: [PATCH] Fix process-contact bug with TCP connections This fixes a regression from Emacs 25.3 (Bug#34134). * src/process.c (server_accept_connection): Set host correctly, fixing a bug introduced in 2017-09-16T21:29:18Z!eggert@cs.ucla.edu when working around a GCC bug. --- src/process.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/process.c b/src/process.c index 7f32150e8e..d8acd139c0 100644 --- a/src/process.c +++ b/src/process.c @@ -4724,19 +4724,24 @@ server_accept_connection (Lisp_Object server, int channel) service = Qnil; Lisp_Object args[11]; int nargs = 0; - AUTO_STRING (procname_format_in, "%s <%d.%d.%d.%d:%d>"); - AUTO_STRING (procname_format_in6, "%s <[%x:%x:%x:%x:%x:%x:%x:%x]:%d>"); + #define HOST_FORMAT_IN "%d.%d.%d.%d" + #define HOST_FORMAT_IN6 "%x:%x:%x:%x:%x:%x:%x:%x" + AUTO_STRING (host_format_in, HOST_FORMAT_IN); + AUTO_STRING (host_format_in6, HOST_FORMAT_IN6); + AUTO_STRING (procname_format_in, "%s <"HOST_FORMAT_IN":%d>"); + AUTO_STRING (procname_format_in6, "%s <["HOST_FORMAT_IN6"]:%d>"); AUTO_STRING (procname_format_default, "%s <%d>"); switch (saddr.sa.sa_family) { case AF_INET: { args[nargs++] = procname_format_in; - nargs++; + args[nargs++] = host_format_in; unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr; service = make_number (ntohs (saddr.in.sin_port)); for (int i = 0; i < 4; i++) args[nargs++] = make_number (ip[i]); + host = Fformat (5, args + 1); args[nargs++] = service; } break; @@ -4745,11 +4750,12 @@ server_accept_connection (Lisp_Object server, int channel) case AF_INET6: { args[nargs++] = procname_format_in6; - nargs++; + args[nargs++] = host_format_in6; DECLARE_POINTER_ALIAS (ip6, uint16_t, &saddr.in6.sin6_addr); service = make_number (ntohs (saddr.in.sin_port)); for (int i = 0; i < 8; i++) args[nargs++] = make_number (ip6[i]); + host = Fformat (9, args + 1); args[nargs++] = service; } break; -- 2.20.1 --------------FF28FD76AE92DB6CAE68E0B1--