Re: windows cfbot failing: my_perl

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Justin Pryzby <pryzby@telsasoft.com>, John Naylor <john.naylor@postgresql.org>
Cc: pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@gmail.com>
Date: 2022-08-26T14:27:00Z
Lists: pgsql-hackers
Hi,

On 2022-08-26 06:40:47 -0700, Andres Freund wrote:
> On 2022-08-26 06:21:51 -0700, Andres Freund wrote:
> > On 2022-08-26 06:55:46 -0500, Justin Pryzby wrote:
> > > The last 20 some consecutive builds failed:
> > > https://cirrus-ci.com/github/postgresql-cfbot/postgresql
> > > 
> > > like this:
> > > [09:29:27.711] C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt\malloc.h(159,17): error C2065: 'my_perl': undeclared identifier (compiling source file src/pl/plperl/SPI.c) [c:\cirrus\plperl.vcxproj]
> > > [09:29:27.711] C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt\malloc.h(159,17): error C2065: 'my_perl': undeclared identifier (compiling source file src/pl/plperl/Util.c) [c:\cirrus\plperl.vcxproj]
> > > [09:29:27.711] C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt\malloc.h(159,17): error C2223: left of '->IMem' must point to struct/union (compiling source file src/pl/plperl/SPI.c) [c:\cirrus\plperl.vcxproj]
> > > [09:29:27.711] C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt\malloc.h(159,17): error C2223: left of '->IMem' must point to struct/union (compiling source file src/pl/plperl/Util.c) [c:\cirrus\plperl.vcxproj]
> > > 
> > > I imagine it may be due to an error hit while rebuilding the ci's docker image.
> > 
> > I don't think it's CI specific, see
> > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=hamerkop&dt=2022-08-26%2011%3A00%3A11
> > 
> > Looks like the failures might have started with
> > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=121d2d3d70ecdb2113b340c5f3b99a61341291af
> > based on
> > https://cirrus-ci.com/github/postgres/postgres/
> > 
> > Not immediately obvious why that would be.
> 
> Reproduces in a VM, it starts to fail with that commit. Looks like somehow
> different macros are trampling on each other. Something in perl is interfering
> with msvc's malloc.h, turning
> 
>             if (_Marker == _ALLOCA_S_HEAP_MARKER)
>             {
>                 free(_Memory);
>             }
> into
> 
>             if (_Marker == 0xDDDD)
>             {
>                 (*(my_perl->IMem)->pFree)((my_perl->IMem), (_Memory));
>             }
> 
> after preprocessing. No idea how.

Because perl, extremely unhelpfully, #defines free. Which, not surprisingly,
causes issues when including system headers referencing free as well.

I don't really see a good solution to this other than hoisting the
mb/pg_wchar.h include out to before we include all the perl stuff. That does
fix the issue.

Greetings,

Andres Freund



Commits

  1. Be more careful to avoid including system headers after perl.h

  2. Use SSE2 in is_valid_ascii() where available.