Re: msys inet_pton strangeness

Alexander Law <exclusion@gmail.com>

From: Alexander Lakhin <exclusion@gmail.com>
To: Andrew Dunstan <andrew@dunslane.net>, Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-09-29T20:00:00Z
Lists: pgsql-hackers
29.09.2024 18:47, Andrew Dunstan wrote:
> 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.
>

As far as I can see, in my environment  _WIN32_WINNT defined with
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x603
#endif

inside C:/msys64/ucrt64/include/_mingw.h, which can be included
                  from C:/msys64/ucrt64/include/corecrt.h:10,
                  from C:/msys64/ucrt64/include/crtdefs.h:10,
                  from ../../../src/include/pg_config_os.h:40,
                  from ../../../src/include/c.h:56,
                  from ../../../src/include/postgres_fe.h:25,
                  from fe-secure-common.c:20

or (if HAVE_CRTDEFS_H is not defined):
                  from C:/msys64/ucrt64/include/corecrt.h:10,
                  from C:/msys64/ucrt64/include/corecrt_stdio_config.h:10,
                  from C:/msys64/ucrt64/include/stdio.h:9,
                  from ../../../src/include/c.h:59,
                  from ../../../src/include/postgres_fe.h:25,
                  from fe-secure-common.c:20

or (if winsock2.h included directly):
                  from C:/msys64/ucrt64/include/windows.h:9,
                  from C:/msys64/ucrt64/include/winsock2.h:23

so including winsock2.h is sufficient to include _mingw.h, but it doesn't
redefine _WIN32_WINNT, unfortunately.

Best regards,
Alexander

Commits

  1. Bump MIN_WINNT for MINGW to clear a build error

  2. Make Windows 10 the minimal runtime requirement for WIN32

  3. libpq: Allow IP address SANs in server certificates