From debbugs-submit-bounces@debbugs.gnu.org Tue May 24 20:26:31 2016 Received: (at submit) by debbugs.gnu.org; 25 May 2016 00:26:31 +0000 Received: from localhost ([127.0.0.1]:36865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5Mec-00017J-S7 for submit@debbugs.gnu.org; Tue, 24 May 2016 20:26:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5Meb-000176-JD for submit@debbugs.gnu.org; Tue, 24 May 2016 20:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5MeV-000428-I4 for submit@debbugs.gnu.org; Tue, 24 May 2016 20:26:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5MeV-00041z-Eu for submit@debbugs.gnu.org; Tue, 24 May 2016 20:26:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5MeT-0004xu-8j for bug-gnu-emacs@gnu.org; Tue, 24 May 2016 20:26:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5MeO-00041B-7Q for bug-gnu-emacs@gnu.org; Tue, 24 May 2016 20:26:20 -0400 Received: from limerock01.mail.cornell.edu ([128.84.13.241]:58814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5MeO-000416-1U for bug-gnu-emacs@gnu.org; Tue, 24 May 2016 20:26:16 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock01.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u4P0QEZo020039 for ; Tue, 24 May 2016 20:26:14 -0400 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 u4P0QDPk020886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Tue, 24 May 2016 20:26:14 -0400 To: bug-gnu-emacs@gnu.org Subject: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? From: Ken Brown Message-ID: Date: Tue, 24 May 2016 20:26:13 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=XXXXX X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) There are two places in process.c where getsockopt(,,SO_ERROR,,) is used to check the status of a socket connection attempt. The first is at line 3289, where it is done on all platforms except MS Windows. The second is at line 5500, where it is done only on GNU/Linux: #ifdef GNU_LINUX /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. So only use it on systems where it is known to work. */ { socklen_t xlen = sizeof (xerrno); if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) xerrno = errno; } #else { struct sockaddr pname; socklen_t pnamelen = sizeof (pname); /* If connection failed, getpeername will fail. */ xerrno = 0; if (getpeername (channel, &pname, &pnamelen) < 0) { /* Obtain connect failure code through error slippage. */ char dummy; xerrno = errno; if (errno == ENOTCONN && read (channel, &dummy, 1) < 0) xerrno = errno; } } #endif It would be better to use it on as many platforms as possible, since it's much more likely to give the real reason for a connection failure than the "error slippage" method. Ken From debbugs-submit-bounces@debbugs.gnu.org Wed May 25 12:24:51 2016 Received: (at 23615) by debbugs.gnu.org; 25 May 2016 16:24:51 +0000 Received: from localhost ([127.0.0.1]:38474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5bc2-0002UP-TC for submit@debbugs.gnu.org; Wed, 25 May 2016 12:24:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5bc1-0002UC-D8 for 23615@debbugs.gnu.org; Wed, 25 May 2016 12:24:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5bbt-0000Cp-8U for 23615@debbugs.gnu.org; Wed, 25 May 2016 12:24:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5bbt-0000Cl-4R; Wed, 25 May 2016 12:24:41 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1401 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b5bbs-0001Wx-9m; Wed, 25 May 2016 12:24:40 -0400 Date: Wed, 25 May 2016 19:24:45 +0300 Message-Id: <8337p63y2a.fsf@gnu.org> From: Eli Zaretskii To: Ken Brown In-reply-to: (message from Ken Brown on Tue, 24 May 2016 20:26:13 -0400) Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) > From: Ken Brown > Date: Tue, 24 May 2016 20:26:13 -0400 > > There are two places in process.c where getsockopt(,,SO_ERROR,,) is > used to check the status of a socket connection attempt. The first is > at line 3289, where it is done on all platforms except MS Windows. The > second is at line 5500, where it is done only on GNU/Linux: FYI, the first instance is ifdef'ed away for Windows because we can never have EINTR on Windows, and the surrounding code that handles that case is tricky to get to compile on Windows (since we override the definitions of FD_* macros with our own). MS-Windows does support SO_ERROR. > It would be better to use it on as many platforms as possible, since > it's much more likely to give the real reason for a connection failure > than the "error slippage" method. Perhaps you or someone could write a small test program, and then people here could run it various platforms and provide feedback. From debbugs-submit-bounces@debbugs.gnu.org Wed May 25 15:22:05 2016 Received: (at 23615) by debbugs.gnu.org; 25 May 2016 19:22:05 +0000 Received: from localhost ([127.0.0.1]:38594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5eNZ-0008Je-0g for submit@debbugs.gnu.org; Wed, 25 May 2016 15:22:05 -0400 Received: from limerock04.mail.cornell.edu ([128.84.13.244]:59126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5eNX-0008JA-7M for 23615@debbugs.gnu.org; Wed, 25 May 2016 15:22:03 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u4PJLvwF031788; Wed, 25 May 2016 15:21:57 -0400 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 u4PJLu8m031125 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 25 May 2016 15:21:56 -0400 Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Eli Zaretskii References: <8337p63y2a.fsf@gnu.org> From: Ken Brown Message-ID: <8080c018-3cc8-c97e-0654-dc98be95a7ef@cornell.edu> Date: Wed, 25 May 2016 15:21:56 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <8337p63y2a.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------5E8DBF5DFE7AD47D5AEF2F62" X-PMX-Cornell-Gauge: Gauge=XXXXX X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) This is a multi-part message in MIME format. --------------5E8DBF5DFE7AD47D5AEF2F62 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 5/25/2016 12:24 PM, Eli Zaretskii wrote: > Perhaps you or someone could write a small test program, and then > people here could run it various platforms and provide feedback. Test program attached. It simulates the situation of bug 23606 (before the bug was fixed). Here's what happens on Cygwin: $ gcc -o socket_test socket_test.c $ ./socket_test.exe Server listening on port 50176. Attempting client connection...failure: Connection refused. Ken --------------5E8DBF5DFE7AD47D5AEF2F62 Content-Type: text/plain; charset=UTF-8; name="socket_test.c" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="socket_test.c" #include #include #include #include #include #include #include #include #include /* Return file descriptor or -1. */ int make_connection (int server, int *pservice); int main(void) { int sfd, cfd, xerrno, service; socklen_t xlen = sizeof (xerrno); sfd = make_connection (1, &service); if (sfd == -1) { fprintf (stderr, "Can't start server.\n"); exit(1); } printf ("Server listening on port %d.\n", service); cfd = make_connection (0, &service); if (cfd == -1) { fprintf (stderr, "Can't start client.\n"); exit (1); } fprintf (stderr, "Attempting client connection..."); /* Here we should use 'select' to wait for cfd to be ready for writing. To simplify the test, I’m just calling 'sleep'. */ sleep (2); if (getsockopt (cfd, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) { perror ("getsockopt"); exit (1); } if (xerrno) printf ("failure: %s.\n", strerror (xerrno)); else printf ("success.\n"); exit (0); } int make_connection (int server, int *pservice) { struct addrinfo hints, *result, *rp; int family, optval, ret, s = -1; const char *host; const char *portstring; char portbuf[128]; struct sockaddr_in sa; socklen_t len = sizeof (sa); if (server) /* Assigned port will be returned in pservice. */ { family = AF_INET; portstring = "0"; host = "127.0.0.1"; } else /* Client; desired port should be specified in pservice. */ { family = AF_UNSPEC; portstring = portbuf; sprintf (portbuf, "%d", *pservice); host = "localhost"; } memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_socktype = SOCK_STREAM; hints.ai_family = family; if (getaddrinfo (host, portstring, &hints, &result)) return -1; optval = 1; for (rp = result; rp; rp = rp->ai_next) { s = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (s == -1) continue; if (server) { if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) == -1) { perror ("setsockopt"); close (s); return -1; } if (bind (s, rp->ai_addr, rp->ai_addrlen)) { perror ("bind"); close (s); return -1; } if (listen (s, 5)) { perror ("listen"); close (s); return -1; } if (getsockname (s, (struct sockaddr *) &sa, &len)) { perror ("getsockname"); close (s); return -1; } *pservice = ntohs (sa.sin_port); } else /* Nonblocking client. */ { if (fcntl (s, F_SETFL, O_NONBLOCK) == -1) { close (s); s = -1; continue; } } ret = connect (s, rp->ai_addr, rp->ai_addrlen); if (ret == 0 || errno == EISCONN) break; if (!server && errno == EINPROGRESS) break; close (s); s = -1; } freeaddrinfo(result); return s; } --------------5E8DBF5DFE7AD47D5AEF2F62-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 28 08:57:01 2016 Received: (at 23615) by debbugs.gnu.org; 28 May 2016 12:57:02 +0000 Received: from localhost ([127.0.0.1]:43279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6dnZ-0008Op-Im for submit@debbugs.gnu.org; Sat, 28 May 2016 08:57:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39959) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6dnX-0008OX-8m for 23615@debbugs.gnu.org; Sat, 28 May 2016 08:57:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6dnO-00052O-Rm for 23615@debbugs.gnu.org; Sat, 28 May 2016 08:56:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6dnO-00052I-O4; Sat, 28 May 2016 08:56:50 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2215 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b6dnN-0002xu-S0; Sat, 28 May 2016 08:56:50 -0400 Date: Sat, 28 May 2016 15:57:00 +0300 Message-Id: <83twhixrvn.fsf@gnu.org> From: Eli Zaretskii To: Ken Brown In-reply-to: <8080c018-3cc8-c97e-0654-dc98be95a7ef@cornell.edu> (message from Ken Brown on Wed, 25 May 2016 15:21:56 -0400) Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? References: <8337p63y2a.fsf@gnu.org> <8080c018-3cc8-c97e-0654-dc98be95a7ef@cornell.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) --=-=-= Content-Type: text/plain > Cc: 23615@debbugs.gnu.org > From: Ken Brown > Date: Wed, 25 May 2016 15:21:56 -0400 > > On 5/25/2016 12:24 PM, Eli Zaretskii wrote: > > Perhaps you or someone could write a small test program, and then > > people here could run it various platforms and provide feedback. > > Test program attached. It simulates the situation of bug 23606 (before > the bug was fixed). Here's what happens on Cygwin: > > $ gcc -o socket_test socket_test.c > > $ ./socket_test.exe > Server listening on port 50176. > Attempting client connection...failure: Connection refused. With MinGW, I get this instead: D:\usr\eli\data>socket_test Server listening on port 2213. Attempting client connection...success. Do we have to have a failure in this case? Or is the above a valid outcome? Of course, I needed to hack the code quite a lot to get it compile on MS-Windows; the result is attached below. Maybe I broke the code while doing that? (I don't think calling 'connect' after 'listen' is supposed to work; on Windows it predictably fails with EINVAL, as documented on MSDN.) --=-=-= Content-Type: application/octet-stream Content-Dis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c29ja2FkZHIgKikgJnNhLCAmbGVuKSkKCSAgICB7CgkgICAgICBwZXJyb3IgKCJnZXRzb2NrbmFt ZSIpOwoJICAgICAgY2xvc2Vfc29ja2V0IChzKTsKCSAgICAgIHJldHVybiAtMTsKCSAgICB9Cgkg ICpwc2VydmljZSA9IG50b2hzIChzYS5zaW5fcG9ydCk7CgkgIHJldCA9IDA7Cgl9CiAgICAgIGVs c2UKCS8qIE5vbmJsb2NraW5nIGNsaWVudC4gICovCgl7CgkgIGlmIChzZXRfbmJsb2NrIChzKSA9 PSAtMSkKCSAgICB7CgkgICAgICBjbG9zZV9zb2NrZXQgKHMpOwoJICAgICAgcyA9IC0xOwoJICAg ICAgY29udGludWU7CgkgICAgfQoJICByZXQgPSBjb25uZWN0IChzLCBycC0+YWlfYWRkciwgcnAt PmFpX2FkZHJsZW4pOwoJfQojaWZkZWYgX19NSU5HVzMyX18KICAgICAgeGVycm5vID0gV1NBR2V0 TGFzdEVycm9yICgpOwojZWxzZQogICAgICB4ZXJybm8gPSBlcnJubzsKI2VuZGlmCiAgICAgIGlm IChyZXQgPT0gMCB8fCB4ZXJybm8gPT0gRUlTQ09OTikKCWJyZWFrOwogICAgICBpZiAoIXNlcnZl ciAmJiAoeGVycm5vID09IEVJTlBST0dSRVNTIHx8IHhlcnJubyA9PSBFV09VTERCTE9DSykpCgli cmVhazsKICAgICAgY2xvc2Vfc29ja2V0IChzKTsKICAgICAgcyA9IC0xOwogICAgfQogIGZyZWVh ZGRyaW5mbyhyZXN1bHQpOwogIHJldHVybiBzOwp9Cg== --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 28 13:18:36 2016 Received: (at 23615) by debbugs.gnu.org; 28 May 2016 17:18:36 +0000 Received: from localhost ([127.0.0.1]:44994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6hsi-0008CM-Eq for submit@debbugs.gnu.org; Sat, 28 May 2016 13:18:36 -0400 Received: from limerock04.mail.cornell.edu ([128.84.13.244]:51357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6hsg-0008C9-RC for 23615@debbugs.gnu.org; Sat, 28 May 2016 13:18:35 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u4SHISdo029119; Sat, 28 May 2016 13:18:29 -0400 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 u4SHIRXU027327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 28 May 2016 13:18:28 -0400 Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Eli Zaretskii References: <8337p63y2a.fsf@gnu.org> <8080c018-3cc8-c97e-0654-dc98be95a7ef@cornell.edu> <83twhixrvn.fsf@gnu.org> From: Ken Brown Message-ID: <8906f53e-95c4-cf5d-0e93-56a9f080a1ea@cornell.edu> Date: Sat, 28 May 2016 13:18:27 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <83twhixrvn.fsf@gnu.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=XXXXX X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) On 5/28/2016 8:57 AM, Eli Zaretskii wrote: >> From: Ken Brown >> Test program attached. It simulates the situation of bug 23606 (before >> the bug was fixed). Here's what happens on Cygwin: >> >> $ gcc -o socket_test socket_test.c >> >> $ ./socket_test.exe >> Server listening on port 50176. >> Attempting client connection...failure: Connection refused. > > With MinGW, I get this instead: > > D:\usr\eli\data>socket_test > Server listening on port 2213. > Attempting client connection...success. > > Do we have to have a failure in this case? Or is the above a valid > outcome? It's a valid outcome. I think the reason the connection is refused on Cygwin (and apparently on RHEL 7.2) is that the first addrinfo structure returned by getaddrinfo has an IPv6 address. There's no reason to expect this to happen on all platforms. > Of course, I needed to hack the code quite a lot to get it compile on > MS-Windows; the result is attached below. Maybe I broke the code > while doing that? No, you didn't. I get the same results as before with your version, after fixing a couple of typos that don't affect the MinGW build. (You forgot a semicolon at the end of line 41, and you misspelled "strerror" in line 126.) > (I don't think calling 'connect' after 'listen' is supposed to work; > on Windows it predictably fails with EINVAL, as documented on MSDN.) I think on Posix systems it fails with EISCONN. I put the call in because it's done in the code in process.c that I was imitating, but omitting it as you did is fine also. Thanks for testing. Ken From debbugs-submit-bounces@debbugs.gnu.org Sat May 28 13:48:56 2016 Received: (at 23615) by debbugs.gnu.org; 28 May 2016 17:48:57 +0000 Received: from localhost ([127.0.0.1]:45011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6iM4-0000Uv-M5 for submit@debbugs.gnu.org; Sat, 28 May 2016 13:48:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6iM3-0000Uk-KT for 23615@debbugs.gnu.org; Sat, 28 May 2016 13:48:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6iLu-0004Vv-8Z for 23615@debbugs.gnu.org; Sat, 28 May 2016 13:48:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6iLu-0004V4-5Q; Sat, 28 May 2016 13:48:46 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2423 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b6iLp-0006au-Nb; Sat, 28 May 2016 13:48:43 -0400 Date: Sat, 28 May 2016 20:48:45 +0300 Message-Id: <83pos6xede.fsf@gnu.org> From: Eli Zaretskii To: Ken Brown In-reply-to: <8906f53e-95c4-cf5d-0e93-56a9f080a1ea@cornell.edu> (message from Ken Brown on Sat, 28 May 2016 13:18:27 -0400) Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? References: <8337p63y2a.fsf@gnu.org> <8080c018-3cc8-c97e-0654-dc98be95a7ef@cornell.edu> <83twhixrvn.fsf@gnu.org> <8906f53e-95c4-cf5d-0e93-56a9f080a1ea@cornell.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) > Cc: 23615@debbugs.gnu.org > From: Ken Brown > Date: Sat, 28 May 2016 13:18:27 -0400 > > > With MinGW, I get this instead: > > > > D:\usr\eli\data>socket_test > > Server listening on port 2213. > > Attempting client connection...success. > > > > Do we have to have a failure in this case? Or is the above a valid > > outcome? > > It's a valid outcome. I think the reason the connection is refused on > Cygwin (and apparently on RHEL 7.2) is that the first addrinfo structure > returned by getaddrinfo has an IPv6 address. There's no reason to > expect this to happen on all platforms. OK, thanks. So hopefully others will chime in with results from other platforms. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 02 12:00:09 2016 Received: (at 23615) by debbugs.gnu.org; 2 Jun 2016 16:00:09 +0000 Received: from localhost ([127.0.0.1]:51912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8V2X-0007dj-CL for submit@debbugs.gnu.org; Thu, 02 Jun 2016 12:00:09 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8V2V-0007cR-U7 for 23615@debbugs.gnu.org; Thu, 02 Jun 2016 12:00:08 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C84AC16141C; Thu, 2 Jun 2016 09:00:01 -0700 (PDT) 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 nFAsx1KTVgrl; Thu, 2 Jun 2016 09:00:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 28609161421; Thu, 2 Jun 2016 09:00:01 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 r4rSMBT4VxEB; Thu, 2 Jun 2016 09:00:01 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 12D36161420; Thu, 2 Jun 2016 09:00:01 -0700 (PDT) To: Ken Brown From: Paul Eggert Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? Organization: UCLA Computer Science Department Message-ID: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> Date: Thu, 2 Jun 2016 09:00:00 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Solaris 10 on a host with only IPv4 configured, socket_test.c fails with the diagnostic "Can't start server." 'truss' says connect(3, 0x00021EE8, 16, SOV_DEFAULT) failed with errno == EOPNOTSUPP. On Solaris 11 with both IPv4 and IPv6, the same symptoms except errno == EADDRNOTAVAIL. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 02 13:17:48 2016 Received: (at 23615) by debbugs.gnu.org; 2 Jun 2016 17:17:48 +0000 Received: from localhost ([127.0.0.1]:51979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8WFg-0002en-7S for submit@debbugs.gnu.org; Thu, 02 Jun 2016 13:17:48 -0400 Received: from limerock04.mail.cornell.edu ([128.84.13.244]:37331) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8WFe-0002eY-9Y for 23615@debbugs.gnu.org; Thu, 02 Jun 2016 13:17:46 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u52HHWGi017055; Thu, 2 Jun 2016 13:17:32 -0400 Received: from [192.168.1.5] (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 u52HHVYr015393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 2 Jun 2016 13:17:32 -0400 Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Paul Eggert References: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> From: Ken Brown Message-ID: Date: Thu, 2 Jun 2016 13:17:34 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=XXXXX X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) On 6/2/2016 12:00 PM, Paul Eggert wrote: > On Solaris 10 on a host with only IPv4 configured, socket_test.c fails > with the diagnostic "Can't start server." 'truss' says connect(3, > 0x00021EE8, 16, SOV_DEFAULT) failed with errno == EOPNOTSUPP. > > On Solaris 11 with both IPv4 and IPv6, the same symptoms except errno == > EADDRNOTAVAIL. Thanks for testing. This means that my test program is not portable enough to answer the question in the subject; the failure occurred before the program reached the getsockopt call. I'll see if I can fix that. Ken From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 02 13:55:21 2016 Received: (at 23615) by debbugs.gnu.org; 2 Jun 2016 17:55:22 +0000 Received: from localhost ([127.0.0.1]:52000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Wq1-0005DY-M6 for submit@debbugs.gnu.org; Thu, 02 Jun 2016 13:55:21 -0400 Received: from limerock04.mail.cornell.edu ([128.84.13.244]:49831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Wq0-0005DM-H1 for 23615@debbugs.gnu.org; Thu, 02 Jun 2016 13:55:20 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u52HtCKF006635; Thu, 2 Jun 2016 13:55:13 -0400 Received: from [192.168.1.5] (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 u52HtB4M029805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 2 Jun 2016 13:55:12 -0400 Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Paul Eggert References: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> From: Ken Brown Message-ID: <94329b2c-754f-c674-daa9-362284862220@cornell.edu> Date: Thu, 2 Jun 2016 13:55:14 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=XXXXX X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) On 6/2/2016 1:17 PM, Ken Brown wrote: > On 6/2/2016 12:00 PM, Paul Eggert wrote: >> On Solaris 10 on a host with only IPv4 configured, socket_test.c fails >> with the diagnostic "Can't start server." 'truss' says connect(3, >> 0x00021EE8, 16, SOV_DEFAULT) failed with errno == EOPNOTSUPP. >> >> On Solaris 11 with both IPv4 and IPv6, the same symptoms except errno == >> EADDRNOTAVAIL. > > Thanks for testing. This means that my test program is not portable > enough to answer the question in the subject; the failure occurred > before the program reached the getsockopt call. I'll see if I can fix > that. I wonder if the problem was calling 'connect' after calling 'listen'. Eli pointed out that this doesn't work on MS-Windows, and in any case I can't see why it would ever be needed. (I only did it because the code in process.c that I was imitating did it.) Does the following help? --- socket_test.c~ 2016-05-25 21:27:46.000000000 -0400 +++ socket_test.c 2016-06-02 13:47:52.719883900 -0400 @@ -122,6 +122,7 @@ return -1; } *pservice = ntohs (sa.sin_port); + ret = 0; } else /* Nonblocking client. */ @@ -132,8 +133,8 @@ s = -1; continue; } + ret = connect (s, rp->ai_addr, rp->ai_addrlen); } - ret = connect (s, rp->ai_addr, rp->ai_addrlen); if (ret == 0 || errno == EISCONN) break; if (!server && errno == EINPROGRESS) From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 02 14:55:13 2016 Received: (at 23615) by debbugs.gnu.org; 2 Jun 2016 18:55:13 +0000 Received: from localhost ([127.0.0.1]:52025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Xlx-0008An-EK for submit@debbugs.gnu.org; Thu, 02 Jun 2016 14:55:13 -0400 Received: from limerock04.mail.cornell.edu ([128.84.13.244]:45209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Xlv-0008Aa-UP for 23615@debbugs.gnu.org; Thu, 02 Jun 2016 14:55:12 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u52It5mD013654; Thu, 2 Jun 2016 14:55:05 -0400 Received: from [192.168.1.5] (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 u52It4OW026555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 2 Jun 2016 14:55:04 -0400 Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Paul Eggert References: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> <94329b2c-754f-c674-daa9-362284862220@cornell.edu> From: Ken Brown Message-ID: Date: Thu, 2 Jun 2016 14:55:07 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <94329b2c-754f-c674-daa9-362284862220@cornell.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=XXXXX X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 23615 Cc: 23615@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) On 6/2/2016 1:55 PM, Ken Brown wrote: > I wonder if the problem was calling 'connect' after calling 'listen'. > Eli pointed out that this doesn't work on MS-Windows, and in any case I > can't see why it would ever be needed. (I only did it because the code > in process.c that I was imitating did it.) Sorry, I misread the code. process.c doesn't call 'connect' after calling 'listen'. Ken From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 08:38:53 2016 Received: (at 23615-done) by debbugs.gnu.org; 10 Jun 2016 12:38:53 +0000 Received: from localhost ([127.0.0.1]:35212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBLi8-0007Q5-T9 for submit@debbugs.gnu.org; Fri, 10 Jun 2016 08:38:53 -0400 Received: from limerock04.mail.cornell.edu ([128.84.13.244]:34217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBLi7-0007Pt-J1 for 23615-done@debbugs.gnu.org; Fri, 10 Jun 2016 08:38:51 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id u5ACcc29022335; Fri, 10 Jun 2016 08:38:39 -0400 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 u5ACcbVR021680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 10 Jun 2016 08:38:38 -0400 Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Paul Eggert References: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> <94329b2c-754f-c674-daa9-362284862220@cornell.edu> From: Ken Brown Message-ID: <9f6fc827-c90b-cb32-59a0-8417199c7ec5@cornell.edu> Date: Fri, 10 Jun 2016 08:38:36 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=XXXXX X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 23615-done Cc: 23615-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) I see that you've made the change I suggested, so my test program is no longer relevant. I'm closing the bug. Ken From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 13:48:45 2016 Received: (at 23615-done) by debbugs.gnu.org; 10 Jun 2016 17:48:45 +0000 Received: from localhost ([127.0.0.1]:36220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBQY1-0006vq-Ba for submit@debbugs.gnu.org; Fri, 10 Jun 2016 13:48:45 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58585) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBQXz-0006vc-G3 for 23615-done@debbugs.gnu.org; Fri, 10 Jun 2016 13:48:43 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 87D70161512; Fri, 10 Jun 2016 10:48:37 -0700 (PDT) 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 Sixtv706asxu; Fri, 10 Jun 2016 10:48:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 84EB0161513; Fri, 10 Jun 2016 10:48:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 H2n5FmJu97_R; Fri, 10 Jun 2016 10:48:36 -0700 (PDT) Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 66594161512; Fri, 10 Jun 2016 10:48:36 -0700 (PDT) Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? To: Ken Brown References: <3383267a-8631-a2a3-7914-ee54e68b1b07@cs.ucla.edu> <94329b2c-754f-c674-daa9-362284862220@cornell.edu> <9f6fc827-c90b-cb32-59a0-8417199c7ec5@cornell.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <575AFD74.80901@cs.ucla.edu> Date: Fri, 10 Jun 2016 10:48:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <9f6fc827-c90b-cb32-59a0-8417199c7ec5@cornell.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 23615-done Cc: 23615-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Ken Brown wrote: > I see that you've made the change I suggested, so my test program is no longer > relevant. I'm closing the bug. Thanks, to be honest I had forgotten all about the bug! I ran into this problem again why trying to fix another bug, and this patch was separable from the main fix (which I haven't installed yet). From unknown Mon Jun 23 23:49:08 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 09 Jul 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator