From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Alexander Lakhin <exclusion(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: msys inet_pton strangeness |
Date: | 2024-09-29 15:47:23 |
Message-ID: | 62ae3e3b-369e-4fbd-8f3b-e0711d9a916f@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2024-09-29 Su 1:00 AM, Alexander Lakhin wrote:
> Hello Thomas and Andrew,
>
> 28.09.2024 23:52, Thomas Munro wrote:
>> On Sun, Sep 29, 2024 at 6:26 AM Andrew Dunstan <andrew(at)dunslane(dot)net>
>> wrote:
>>> We should have included ws2tcpip.h, which includes this:
>>>
>>> #define InetPtonA inet_pton
>>> WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR
>>> pStringBuf, PVOID pAddr);
>>>
>>> It's conditioned on (_WIN32_WINNT >= 0x0600), but that should be true.
>> Can you print out the value to be sure? I can't imagine they'd set it
>> lower themselves or make it go backwards in an upgrade, but perhaps
>> it's somehow not being set at all, and then we do:
>>
>> #if defined(_MSC_VER) && _MSC_VER >= 1900
>> #define MIN_WINNT 0x0600
>> #else
>> #define MIN_WINNT 0x0501
>> #endif
>>
>> In 16 we don't do that anymore, we just always set it to 0x0A00
>> (commit 495ed0ef2d72). And before 15, we didn't want that function
>> yet (commit c1932e542863).
>
> FWIW, I'm observing the same here.
> For a trivial test.c (compiled with the same command line as
> fe-secure-common.c) like:
> "===_WIN32"
> _WIN32;
> "===_WIN32_WINNT";
> _WIN32_WINNT;
>
> with gcc -E (from mingw-w64-ucrt-x86_64-gcc 14.2.0-1), I get:
> "===_WIN32"
> 1;
> "===_WIN32_WINNT";
> _WIN32_WINNT;
>
> That is, _WIN32_WINNT is not defined, but with #include <windows.h>
> above,
> I see:
> "===_WIN32_WINNT";
> 0x603
>
> With #include "postgres_fe.h" (as in fe-secure-common.c) I get:
> "===_WIN32_WINNT";
> 0x0501;
>
>
>
Yeah, src/include/port/win32/sys/socket.h has:
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
I'm inclined to think we might need to reverse the order of the last
two. TBH I don't really understand how this has worked up to now.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-09-29 16:24:13 | Re: msys inet_pton strangeness |
Previous Message | Amit Kapila | 2024-09-29 13:03:29 | Re: First draft of PG 17 release notes |