Re: msys inet_pton strangeness - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: msys inet_pton strangeness
Date
Msg-id bcbfcce7-fc92-76da-7108-6f1113a2c514@gmail.com
Whole thread Raw
In response to Re: msys inet_pton strangeness  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: msys inet_pton strangeness
List 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



pgsql-hackers by date:

Previous
From: Yugo Nagata
Date:
Subject: Re: ACL_MAINTAIN, Lack of comment content
Next
From: Tatsuo Ishii
Date:
Subject: Re: Doc: typo in config.sgml