Message ID | CAGHpTBJf7rkWKVvmqAFemhu+aqT9CTVE7bYp1__Yo+5F-R=87w@mail.gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 46759 invoked by alias); 17 Nov 2019 10:46:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 46742 invoked by uid 89); 17 Nov 2019 10:46:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*c:alternative, HX-Received:Sun X-HELO: mail-oi1-f195.google.com Received: from mail-oi1-f195.google.com (HELO mail-oi1-f195.google.com) (209.85.167.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Nov 2019 10:46:31 +0000 Received: by mail-oi1-f195.google.com with SMTP id s71so12644759oih.11 for <gdb-patches@sourceware.org>; Sun, 17 Nov 2019 02:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=QFgAQ7aUcLFjZlwhGr+HPWHudpTjg/5b/EXCUcrQUVg=; b=P7h01xeJx/IVIDiav/4alZwkH1je+snz16+Fw7fStfMk13I8JC0Qm/SirhIc62vQy5 wdqXuFzWJlAJQY86owM1z/U9/mPSUE0ufW/JEkBjqu8uKNxAqnsuq72rcJB/xWJ3SDf7 ZGOFX2tNRVqrtOTk4K3jFUid9/bG/hVlInFiVBql7YLI0gBzregUUPwhXN6fl2t9guui L1D5X3kTLVqBgZdCAJbu4PZ99WxheXsTZEpiCYQfYEsKEUtanMCsrUNqv3RjeVonPvYq vv+H9COJ90Jo7KP51+AdRGT2t2UaJY336jqQWvkkPArR3HKfPZI8E7L74X403EgHcdt6 JoCg== MIME-Version: 1.0 From: Orgad Shaneh <orgads@gmail.com> Date: Sun, 17 Nov 2019 12:46:18 +0200 Message-ID: <CAGHpTBJf7rkWKVvmqAFemhu+aqT9CTVE7bYp1__Yo+5F-R=87w@mail.gmail.com> Subject: [PATCH] mingw: Fix wrong error message on connection timeout To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" |
Commit Message
Orgad Shaneh
Nov. 17, 2019, 10:46 a.m. UTC
ETIMEDOUT is defined as 138. Translating this error code to a readable message gives "The system tried to join a drive to a directory on a joined drive." Since GDB assigns this value directly, it should use a value that the system recognizes correctly. --- gdb/ser-tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.24.0.windows.1.2.g59df941196
Comments
On 2019-11-17 5:46 a.m., Orgad Shaneh wrote: > ETIMEDOUT is defined as 138. Translating this error code to a > readable message gives "The system tried to join a drive to a directory > on a joined drive." > > Since GDB assigns this value directly, it should use a value that > the system recognizes correctly. > --- > gdb/ser-tcp.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c > index 37f64b5d08..a1baa7729e 100644 > --- a/gdb/ser-tcp.c > +++ b/gdb/ser-tcp.c > @@ -40,9 +40,8 @@ > > #ifdef USE_WIN32API > #include <ws2tcpip.h> > -#ifndef ETIMEDOUT > +#undef ETIMEDOUT > #define ETIMEDOUT WSAETIMEDOUT > -#endif > /* Gnulib defines close too, but gnulib's replacement > doesn't call closesocket unless we import the > socketlib module. */ > -- > 2.24.0.windows.1.2.g59df941196 > Hi Orgad, Thanks for the patch. I'd like if we could understand the situation a bit better first, because it looks a bit confusing. Reading the thread where this ifndef has been introduced: https://sourceware.org/ml/gdb-patches/2011-10/msg00759.html the conclusion at the time was that all ETIMEDOUT/WSAETIMEDOUT definitions on mingw64 had the same value, 10060. Looking now, it has been changed to 138: https://github.com/mirror/mingw-w64/blob/3ac71ed3105c2989ba378e2e88d9405f65797178/mingw-w64-headers/crt/errno.h#L221-L224 int this particular commit: https://github.com/mirror/mingw-w64/commit/afae094979944d2d63dbbae125e4a5664538da6c The comment still reads "Defined as WSAETIMEDOUT.", although that doesn't seem true anymore. So the first question is: if strerror(ETIMEDOUT) on mingw64 returns an unrelated error string, is it a mingw64 but? Has it been reported there? While searching for "ETIMEDOUT mingw64", I stumbled on this Stack Overflow answer: https://stackoverflow.com/questions/13523532/strerror-with-mingw-w64 That made me realize that we have imported the strerror_r-posix gnulib module recently. And see here, it specifically handles ETIMEDOUT: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gnulib/import/strerror-override.c;h=9bc9b1895108485403cf8cb9e29723eccc009382;hb=HEAD#l82 So please try to build the current master and see you see the right error string now. Also, since we import the errno gnulib module, which defines ETIMEDOUT, I am pretty sure we actually could get right of these lines altogether: #ifndef ETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT #endif Simon
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 37f64b5d08..a1baa7729e 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -40,9 +40,8 @@ #ifdef USE_WIN32API #include <ws2tcpip.h> -#ifndef ETIMEDOUT +#undef ETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT -#endif /* Gnulib defines close too, but gnulib's replacement doesn't call closesocket unless we import the socketlib module. */