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-30T11:00:00Z
Lists: pgsql-hackers
Hello Andrew and Thomas, 29.09.2024 18:47, Andrew Dunstan пишет: > > 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. > I've looked at the last successful run [1] and discovered that fe-secure-common.c didn't compile cleanly too: ccache gcc ... /home/pgrunner/bf/root/REL_15_STABLE/pgsql.build/../pgsql/src/interfaces/libpq/fe-secure-common.c C:/tools/nmsys64/home/pgrunner/bf/root/REL_15_STABLE/pgsql/src/interfaces/libpq/fe-secure-common.c: In function 'pq_verify_peer_name_matches_certificate_ip': C:/tools/nmsys64/home/pgrunner/bf/root/REL_15_STABLE/pgsql/src/interfaces/libpq/fe-secure-common.c:219:21: warning: implicit declaration of function 'inet_pton'; did you mean 'inet_aton'? [-Wimplicit-function-declaration] 219 | if (inet_pton(AF_INET6, host, &addr) == 1) | ^~~~~~~~~ | inet_aton So it worked just because that missing declaration generated just a warning, not an error. 30.09.2024 01:28, Thomas Munro wrote: > Just an idea... > > --- a/src/include/port/win32.h > +++ b/src/include/port/win32.h > @@ -16,7 +16,7 @@ > * get support for GetLocaleInfoEx() with locales. For everything else > * the minimum version is Windows XP (0x0501). > */ > -#if defined(_MSC_VER) && _MSC_VER >= 1900 > +#if !defined(_MSC_VER) || _MSC_VER >= 1900 > #define MIN_WINNT 0x0600 > #else > #define MIN_WINNT 0x0501 This change works for me in the msys case. I have no VS 2013 on hand to test the other branch, but it looks like HAVE_INET_PTON set to 1 unconditionally in src/tools/msvc/Solution.pm, so we probably will stumble upon the same issue with _MSC_VER = 1800. What if we just set MIN_WINNT 0x0600 for REL_15_STABLE? Or may be it would make sense to get that old Visual Studio and recheck? The other question that I still have is: where we expect to get system _WIN32_WINNT from? As far as I can see, in the fe-secure-common.c case we have the following include chain: #include "postgres_fe.h" #include "c.h" // no other includes above #include "postgres_ext.h" #include "pg_config_ext.h" ... #include "pg_config.h" #include "pg_config_manual.h" /* must be after pg_config.h */ #include "pg_config_os.h" /* must be before any system header files */ // checks _WIN32_WINNT: #if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT So if pg_config_os.h is really included before any system headers, checking _WIN32_WINNT makes sense only when that define passed with -D_WIN32_WINNT, no? [1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=fairywren&dt=2024-09-19%2023%3A10%3A10&stg=build Best regards, Alexander
Commits
-
Bump MIN_WINNT for MINGW to clear a build error
- d700e8d75bc3 15.9 landed
-
Make Windows 10 the minimal runtime requirement for WIN32
- 495ed0ef2d72 16.0 cited
-
libpq: Allow IP address SANs in server certificates
- c1932e542863 15.0 cited