pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pl/perl extension fails on Windows
94+ messages / 12 participants
[nested] [flat]

Commits from this thread:
  2017-12-09 65a00f3035 9b5c99790e 140fa2fbad 1c1a572d05 aed8d41af6 1886899420  MSVC: Test whether 32-bit Perl needs -D_USE_32BIT_TIME_T.
  2017-08-17 b5178c5d08 1d7a479d22 c343314882 bff216d878 4f862351d2 bc4404405f f7e4783ddb  Further tweaks to compiler flags for PL/Perl on Windows.
  2017-08-14 1621a75531 e3335ec0b6 3883be3eae 5a5c2feca3 01de7ea853 25169b948e  Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.
  2017-07-31 df52739ce3 0d8f015e77 1e58c503ec 456c7dff2a 9cbdc68941  PL/Perl portability fix: absorb relevant -D switches from Perl.
  2017-07-31 d48180ec81  PL/Perl portability fix: avoid including XSUB.h in plperl.c.
* pl/perl extension fails on Windows
@ 2017-07-12 12:19 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Sandeep Thakkar @ 2017-07-12 12:19 UTC (permalink / raw)
  To: pgsql-hackers

Hi,

I compiled PG 10 beta1/beta2 with "--with-perl" option on Windows and the
extension crashes the database.
--
postgres=# create extension plperl;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
postgres=#

It doesn't produce crashdump (in $DATA/crashdumps) but the log contains the
following error:

*src/pl/plperl/Util.c: loadable library and perl binaries are mismatched
(got handshake key 0A900080, needed 0AC80080)*
--

This is seen with Perl 5.24 but not with 5.20, 5.16. What I found is that
the handshake function is added in Perl 5.21.x and probably that is why we
don't see this issue in earlier versions.

The Perl that is used during compilation and on the target machine is same.
So probably plperl is not able to load the perl library. It works fine on
Linux and MacOS.

-- 
Sandeep Thakkar
EDB

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
@ 2017-07-12 15:35 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-12 15:35 UTC (permalink / raw)
  To: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; +Cc: pgsql-hackers

Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> writes:
> I compiled PG 10 beta1/beta2 with "--with-perl" option on Windows and the
> extension crashes the database.
> *src/pl/plperl/Util.c: loadable library and perl binaries are mismatched
> (got handshake key 0A900080, needed 0AC80080)*

> This is seen with Perl 5.24 but not with 5.20, 5.16. What I found is that
> the handshake function is added in Perl 5.21.x and probably that is why we
> don't see this issue in earlier versions.

Well, we have various buildfarm machines running perls newer than that,
eg, crake, with 5.24.1.  So I'd say there is something busted about your
perl installation.  Perhaps leftover bits of an older version somewhere?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-12 15:49   ` Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  0 siblings, 2 replies; 94+ messages in thread

From: Dave Page @ 2017-07-12 15:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Wed, Jul 12, 2017 at 4:35 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> writes:
> > I compiled PG 10 beta1/beta2 with "--with-perl" option on Windows and the
> > extension crashes the database.
> > *src/pl/plperl/Util.c: loadable library and perl binaries are mismatched
> > (got handshake key 0A900080, needed 0AC80080)*
>
> > This is seen with Perl 5.24 but not with 5.20, 5.16. What I found is that
> > the handshake function is added in Perl 5.21.x and probably that is why
> we
> > don't see this issue in earlier versions.
>
> Well, we have various buildfarm machines running perls newer than that,
> eg, crake, with 5.24.1.  So I'd say there is something busted about your
> perl installation.  Perhaps leftover bits of an older version somewhere?
>

Well crake is a Fedora box - and we have no problems on Linux, only on
Windows.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
@ 2017-07-12 18:31     ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-12 18:31 UTC (permalink / raw)
  To: Dave Page <dpage@pgadmin.org>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/12/2017 11:49 AM, Dave Page wrote:
>
>
> On Wed, Jul 12, 2017 at 4:35 PM, Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
>     Sandeep Thakkar <sandeep.thakkar@enterprisedb.com
>     <mailto:sandeep.thakkar@enterprisedb.com>> writes:
>     > I compiled PG 10 beta1/beta2 with "--with-perl" option on
>     Windows and the
>     > extension crashes the database.
>     > *src/pl/plperl/Util.c: loadable library and perl binaries are
>     mismatched
>     > (got handshake key 0A900080, needed 0AC80080)*
>
>     > This is seen with Perl 5.24 but not with 5.20, 5.16. What I
>     found is that
>     > the handshake function is added in Perl 5.21.x and probably that
>     is why we
>     > don't see this issue in earlier versions.
>
>     Well, we have various buildfarm machines running perls newer than
>     that,
>     eg, crake, with 5.24.1.  So I'd say there is something busted
>     about your
>     perl installation.  Perhaps leftover bits of an older version
>     somewhere?
>
>
> Well crake is a Fedora box - and we have no problems on Linux, only on
> Windows. 
>
>


Yeah, I have this on one of my Windows boxes, and haven't had time to
get to the bottom of it yet ;-(

Latest versions of ActivePerl don't ship with library descriptor files,
either, which is unpleasant.

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-07-13 12:08       ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-13 12:08 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Dave Page <dpage@pgadmin.org>; Tom Lane <tgl@sss.pgh.pa.us>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Thu, Jul 13, 2017 at 12:01 AM, Andrew Dunstan
<andrew.dunstan@2ndquadrant.com> wrote:
> On 07/12/2017 11:49 AM, Dave Page wrote:
>>
>>
>> Well crake is a Fedora box - and we have no problems on Linux, only on
>> Windows.
>>
>>
>
>
> Yeah, I have this on one of my Windows boxes, and haven't had time to
> get to the bottom of it yet ;-(
>

I could also see this problem in my Windows machine and I have spent
some time to analyse it.  Here are my findings:

The stacktrace where the crash happens is:

  perl524.dll!Perl_xs_handshake(const unsigned long key, void
*v_my_perl, const char * file, ...)  Line 5569 C
  plperl.dll!boot_PostgreSQL__InServer__Util(interpreter * my_perl, cv
* cv)  Line 490 + 0x22 bytes C
  perl524.dll!Perl_pp_entersub(interpreter * my_perl)  Line 3987 + 0xc bytes C
  perl524.dll!Perl_runops_standard(interpreter * my_perl)  Line 41 + 0x6 bytes C
  perl524.dll!S_run_body(interpreter * my_perl, long oldscope)  Line 2485 C
  perl524.dll!perl_run(interpreter * my_perl)  Line 2406 + 0xc bytes C
  plperl.dll!plperl_init_interp()  Line 829 + 0xb bytes C
  plperl.dll!_PG_init()  Line 470 + 0x5 bytes C

I couldn't get much out of above bt, but, one thing i could notice is
that the input key passed to 'Perl_xs_handshake()' function is not
matching with the key being generated inside 'Perl_xs_handshake()',
hence, the handshaking is failing.

Please have a look into the following code snippet from 'perl 5.24'
and 'Util.c' file in plperl respectively,

Perl-5.24:
=======
    got = INT2PTR(void*, (UV)(key & HSm_KEY_MATCH));
    need = (void *)(HS_KEY(FALSE, FALSE, "", "") & HSm_KEY_MATCH);
    if (UNLIKELY(got != need))
        goto bad_handshake;

Util.c in plperl:
==========
485 XS_EXTERNAL(boot_PostgreSQL__InServer__Util)
486 {
487 #if PERL_VERSION_LE(5, 21, 5)
488    dVAR; dXSARGS;
489 #else
490    dVAR; dXSBOOTARGSAPIVERCHK;

Actually the macro 'dXSBOOTARGSAPIVERCHK' in line #490 gets expanded to,

#define XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK
         \
    Perl_xs_handshake(HS_KEY(TRUE, TRUE, "v" PERL_API_VERSION_STRING,
""),      \
        HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING)

And the point to be noted is, the way, the key is being generated in
above macro and in Perl_xs_handshake(). As shown above,
'XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK' macro passes
'PERL_API_VERSION_STRING' as input to HS_KEY() to generate the key and
this key is passed to Perl_xs_handshake function whereas inside
Perl_xs_handshake(), there is no such version string being used to
generate the key. Hence, the key mismatch is seen thereby resulting in
a bad_handshake error.

After doing some study, I could understand that Util.c is generated
from Util.xs by xsubpp compiler at build time. This is being done in
Mkvcbuild.pm file in postgres. If I manually replace
'dXSBOOTARGSAPIVERCHK' macro with 'dXSBOOTARGSNOVERCHK' macro in
src/pl/plperl/Util.c, the things work fine. The diff is as follows,

XS_EXTERNAL(boot_PostgreSQL__InServer__Util)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
-    dVAR; dXSBOOTARGSAPIVERCHK;
+    dVAR; dXSBOOTARGSNOVERCHK;

I need to further investigate, but let me know if you have any ideas.

>
> Latest versions of ActivePerl don't ship with library descriptor files,
> either, which is unpleasant.
>

I too had similar observation and surprisingly, I am seeing
'libperl*.a' file instead of 'perl*.lib' file in most of  the
ActiverPerl versions for Windows.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-13 12:34         ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-14 06:35           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-13 12:34 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Dave Page <dpage@pgadmin.org>; Tom Lane <tgl@sss.pgh.pa.us>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/13/2017 08:08 AM, Ashutosh Sharma wrote:
>
> After doing some study, I could understand that Util.c is generated
> from Util.xs by xsubpp compiler at build time. This is being done in
> Mkvcbuild.pm file in postgres. If I manually replace
> 'dXSBOOTARGSAPIVERCHK' macro with 'dXSBOOTARGSNOVERCHK' macro in
> src/pl/plperl/Util.c, the things work fine. The diff is as follows,
>
> XS_EXTERNAL(boot_PostgreSQL__InServer__Util)
> {
> #if PERL_VERSION_LE(5, 21, 5)
>     dVAR; dXSARGS;
> #else
> -    dVAR; dXSBOOTARGSAPIVERCHK;
> +    dVAR; dXSBOOTARGSNOVERCHK;
>
> I need to further investigate, but let me know if you have any ideas.




Good job hunting this down!


One suggestion I saw in a little googling was that we add this to the XS
file after the inclusion of XSUB.h:

    #undef dXSBOOTARGSAPIVERCHK
    #define dXSBOOTARGSAPIVERCHK dXSBOOTARGSNOVERCHK

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-07-13 14:36           ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-13 14:36 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 07/13/2017 08:08 AM, Ashutosh Sharma wrote:
>> -    dVAR; dXSBOOTARGSAPIVERCHK;
>> +    dVAR; dXSBOOTARGSNOVERCHK;

> Good job hunting this down!
> One suggestion I saw in a little googling was that we add this to the XS
> file after the inclusion of XSUB.h:
>     #undef dXSBOOTARGSAPIVERCHK
>     #define dXSBOOTARGSAPIVERCHK dXSBOOTARGSNOVERCHK

I don't see anything even vaguely like that in the Util.c file generated
by Perl 5.10.1, which is what I've got on my RHEL machine.

What I do notice is this in Util.xs:

VERSIONCHECK: DISABLE

which leads immediately to two questions:

1. Why is your version of xsubpp apparently ignoring this directive
and generating a version check anyway?

2. Why do we have this directive in the first place?  It does not seem
to me like a terribly great idea to ignore low-level version mismatches.

In the same vein, I'm suspicious of proposals to "fix" this problem
by removing the version check, which seems to be where Ashutosh
is headed.  In the long run that seems certain to cause huge headaches.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-13 16:14             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-13 16:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/13/2017 10:36 AM, Tom Lane wrote:
> Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
>> On 07/13/2017 08:08 AM, Ashutosh Sharma wrote:
>>> -    dVAR; dXSBOOTARGSAPIVERCHK;
>>> +    dVAR; dXSBOOTARGSNOVERCHK;
>> Good job hunting this down!
>> One suggestion I saw in a little googling was that we add this to the XS
>> file after the inclusion of XSUB.h:
>>     #undef dXSBOOTARGSAPIVERCHK
>>     #define dXSBOOTARGSAPIVERCHK dXSBOOTARGSNOVERCHK
> I don't see anything even vaguely like that in the Util.c file generated
> by Perl 5.10.1, which is what I've got on my RHEL machine.




This is all fairly modern, so it's hardly surprising that it doesn't
happen with the ancient perl 5.10.

here's a snippet from the generated Util.c on crake (Fedora 25, perl 5.24):

    XS_EXTERNAL(boot_PostgreSQL__InServer__Util); /* prototype to pass
    -Wmissing-prototypes */
    XS_EXTERNAL(boot_PostgreSQL__InServer__Util)
    {
    #if PERL_VERSION_LE(5, 21, 5)
        dVAR; dXSARGS;
    #else
        dVAR; dXSBOOTARGSAPIVERCHK;
    #endif



>
> What I do notice is this in Util.xs:
>
> VERSIONCHECK: DISABLE
>
> which leads immediately to two questions:
>
> 1. Why is your version of xsubpp apparently ignoring this directive
> and generating a version check anyway?
>
> 2. Why do we have this directive in the first place?  It does not seem
> to me like a terribly great idea to ignore low-level version mismatches.
>
> In the same vein, I'm suspicious of proposals to "fix" this problem
> by removing the version check, which seems to be where Ashutosh
> is headed.  In the long run that seems certain to cause huge headaches.



That is a different version check. It's the equivalent of xsubpp's
--noversioncheck flag. The versions it would check are the object file
and the corresponding pm file.

In fact the usage I suggested seems to be blessed in XSUB.h in this comment:

    /* dXSBOOTARGSNOVERCHK has no API in xsubpp to choose it so do
    #undef dXSBOOTARGSXSAPIVERCHK
    #define dXSBOOTARGSXSAPIVERCHK dXSBOOTARGSNOVERCHK */





It would be nice to get to the bottom of why we're getting a version
mismatch on Windows, since we're clearly not getting one on Linux. But
since we've got on happily all these years without the API version check
we might well survive a few more going on as we are.

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-07-13 17:00               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-13 17:00 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> It would be nice to get to the bottom of why we're getting a version
> mismatch on Windows, since we're clearly not getting one on Linux.

Yeah, that's what's bothering me: as long as that remains unexplained,
I don't have any confidence that we're fixing the right thing.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-19 15:48                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-19 15:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Thu, Jul 13, 2017 at 10:30 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
>> It would be nice to get to the bottom of why we're getting a version
>> mismatch on Windows, since we're clearly not getting one on Linux.
>
> Yeah, that's what's bothering me: as long as that remains unexplained,
> I don't have any confidence that we're fixing the right thing.

Okay, I tried to explore on this a bit and my findings are as follows.

On Linux, the handshake key being generated in plperl code i.e. inside
XS_EXTERNAL() in Util.c (generated from Util.xs during build time) and perl
code (inside Perl_xs_handshake function) are same which means the following
condition inside Perl_xs_handshake() becomes true and therefore, there is
no mismatch error.

   got = INT2PTR(void*, (UV)(key & HSm_KEY_MATCH));
   need = (void *)(HS_KEY(FALSE, FALSE, "", "") & HSm_KEY_MATCH);
   if (UNLIKELY(got != need))
       goto bad_handshake;


However, on Windows, the handshake key generated in plperl code inside
XS_EXTERNAL() and in perl code i.e. inside Perl_xs_handshake() are
different thereby resulting in a mismatch error.

Actually the function used for generation of handshake Key i.e HS_KEYp()
considers 'sizeof(PerlInterpreter)' to generate the key and somehow the
sizeof PerlInterpreter is not uniform in plperl and perl modules incase of
Windows but on Linux it remains same in both the modules.

This is how PerlInterpreter is defined in Perl source,





*typedef struct interpreter PerlInterpreter;struct interpreter {#  include
"intrpvar.h"};*

where intrpvar.h has different variables defined inside it and most of the
variables definition are protected with various macros. And there are some
macros that are just defined in perl but not in plperl module which means
the sizeof(PerlInterpreter) on the two modules are going to be different
and thereby resulting in a  different key. But, then the point is, why no
such difference is observed on Linux. Well, as of now, i haven't found the
reason behind it and i am still investigating on it.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


>
>                         regards, tom lane

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-19 16:12                   ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 16:56                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-19 16:12 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> Actually the function used for generation of handshake Key i.e HS_KEYp()
> considers 'sizeof(PerlInterpreter)' to generate the key and somehow the
> sizeof PerlInterpreter is not uniform in plperl and perl modules incase of
> Windows but on Linux it remains same in both the modules.

Yipes.  So actually, this is catching a live ABI problem, which presumably
we've escaped seeing bad effects from only through sheer good luck.
I suppose that the discrepancies in the struct contents only occur after
the last field that plperl happens to touch directly --- but that is
unlikely to be true forever.

> *typedef struct interpreter PerlInterpreter;struct interpreter {#  include
> "intrpvar.h"};*
> where intrpvar.h has different variables defined inside it and most of the
> variables definition are protected with various macros. And there are some
> macros that are just defined in perl but not in plperl module which means
> the sizeof(PerlInterpreter) on the two modules are going to be different
> and thereby resulting in a  different key.

I imagine the route to a solution is to fix things so that the relevant
macros are all defined correctly in both cases.  But why they aren't
already is certainly an interesting question.  Have you identified just
which fields are added or missing relative to what libperl thinks?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-19 16:56                     ` Robert Haas <robertmhaas@gmail.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Robert Haas @ 2017-07-19 16:56 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Wed, Jul 19, 2017 at 12:12 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> Actually the function used for generation of handshake Key i.e HS_KEYp()
>> considers 'sizeof(PerlInterpreter)' to generate the key and somehow the
>> sizeof PerlInterpreter is not uniform in plperl and perl modules incase of
>> Windows but on Linux it remains same in both the modules.
>
> Yipes.

+1 for "yipes".  It sounds like we should really try to fix the
underlying problem, rather than just working around the check.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-19 17:44                     ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 18:09                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 2 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-19 17:44 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Wed, Jul 19, 2017 at 9:42 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> > Actually the function used for generation of handshake Key i.e HS_KEYp()
> > considers 'sizeof(PerlInterpreter)' to generate the key and somehow the
> > sizeof PerlInterpreter is not uniform in plperl and perl modules incase of
> > Windows but on Linux it remains same in both the modules.
>
> Yipes.  So actually, this is catching a live ABI problem, which presumably
> we've escaped seeing bad effects from only through sheer good luck.
> I suppose that the discrepancies in the struct contents only occur after
> the last field that plperl happens to touch directly --- but that is
> unlikely to be true forever.
>
> > *typedef struct interpreter PerlInterpreter;struct interpreter {#  include
> > "intrpvar.h"};*
> > where intrpvar.h has different variables defined inside it and most of the
> > variables definition are protected with various macros. And there are some
> > macros that are just defined in perl but not in plperl module which means
> > the sizeof(PerlInterpreter) on the two modules are going to be different
> > and thereby resulting in a  different key.
>
> I imagine the route to a solution is to fix things so that the relevant
> macros are all defined correctly in both cases.  But why they aren't
> already is certainly an interesting question.  Have you identified just
> which fields are added or missing relative to what libperl thinks?

Here are the list of macros and variables from 'intrpvar.h' file that
are just defined in perl module but not in plperl on Windows,

#ifdef PERL_USES_PL_PIDSTATUS
PERLVAR(I, pidstatus,   HV *)       /* pid-to-status mappings for waitpid */
#endif

#ifdef PERL_SAWAMPERSAND
PERLVAR(I, sawampersand, U8)        /* must save all match strings */
#endif

#ifdef FCRYPT
PERLVARI(I, cryptseen,  bool,   FALSE)  /* has fast crypt() been initialized? */
#else
/* One byte hole in the interpreter structure.  */
#endif

#ifdef USE_REENTRANT_API
PERLVAR(I, reentrant_buffer, REENTR *)  /* here we store the _r buffers */
#endif

#ifdef PERL_GLOBAL_STRUCT_PRIVATE
PERLVARI(I, my_cxt_keys, const char **, NULL) /* per-module array of
pointers to MY_CXT_KEY constants */
# endif

#ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
/* File descriptor to talk to the child which dumps scalars.  */
PERLVARI(I, dumper_fd,  int,    -1)
#endif

#ifdef DEBUG_LEAKING_SCALARS
PERLVARI(I, sv_serial,  U32,    0)  /* SV serial number, used in sv.c */
#endif

#ifdef PERL_TRACE_OPS
PERLVARA(I, op_exec_cnt, OP_max+2, UV)
#endif

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-19 18:09                       ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-19 18:09 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> On Wed, Jul 19, 2017 at 9:42 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I imagine the route to a solution is to fix things so that the relevant
>> macros are all defined correctly in both cases.  But why they aren't
>> already is certainly an interesting question.  Have you identified just
>> which fields are added or missing relative to what libperl thinks?

> Here are the list of macros and variables from 'intrpvar.h' file that
> are just defined in perl module but not in plperl on Windows,

> #ifdef PERL_USES_PL_PIDSTATUS
> PERLVAR(I, pidstatus,   HV *)       /* pid-to-status mappings for waitpid */
> #endif

> #ifdef PERL_SAWAMPERSAND
> PERLVAR(I, sawampersand, U8)        /* must save all match strings */
> #endif

> #ifdef FCRYPT
> PERLVARI(I, cryptseen,  bool,   FALSE)  /* has fast crypt() been initialized? */
> #else
> /* One byte hole in the interpreter structure.  */
> #endif

> #ifdef USE_REENTRANT_API
> PERLVAR(I, reentrant_buffer, REENTR *)  /* here we store the _r buffers */
> #endif

> #ifdef PERL_GLOBAL_STRUCT_PRIVATE
> PERLVARI(I, my_cxt_keys, const char **, NULL) /* per-module array of
> pointers to MY_CXT_KEY constants */
> # endif

> #ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
> /* File descriptor to talk to the child which dumps scalars.  */
> PERLVARI(I, dumper_fd,  int,    -1)
> #endif

> #ifdef DEBUG_LEAKING_SCALARS
> PERLVARI(I, sv_serial,  U32,    0)  /* SV serial number, used in sv.c */
> #endif

> #ifdef PERL_TRACE_OPS
> PERLVARA(I, op_exec_cnt, OP_max+2, UV)
> #endif

Huh.  So those seem like symbols that ought to be exposed somewhere in
Perl's headers.  Perhaps we're failing to #include some "perl_config.h" or
equivalent file that records these ABI options?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-19 21:01                       ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-24 06:28                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  1 sibling, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-19 21:01 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> Here are the list of macros and variables from 'intrpvar.h' file that
> are just defined in perl module but not in plperl on Windows,

> #ifdef PERL_USES_PL_PIDSTATUS
> PERLVAR(I, pidstatus,   HV *)       /* pid-to-status mappings for waitpid */
> #endif

> #ifdef PERL_SAWAMPERSAND
> PERLVAR(I, sawampersand, U8)        /* must save all match strings */
> #endif

I am really suspicious that this means your libperl was built in an unsafe
fashion, that is, by injecting configuration choices as random -D switches
in the build process rather than making sure the choices were recorded in
perl's config.h.  As an example, looking at the perl 5.24.1 headers on
a Fedora box, it looks to me like PERL_SAWAMPERSAND could only get defined
if PERL_COPY_ON_WRITE were not defined, and the only way that that can
happen is if PERL_NO_COW is defined, and there are no references to the
latter anyplace except in this particular #if defined test in perl.h.

Where did your perl installation come from, anyway?  Are you sure the .h
files match up with the executables?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-24 06:28                         ` Noah Misch <noah@leadboat.com>
  2017-07-25 12:58                           ` Re: pl/perl extension fails on Windows Amit Kapila <amit.kapila16@gmail.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Noah Misch @ 2017-07-24 06:28 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Wed, Jul 19, 2017 at 05:01:31PM -0400, Tom Lane wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> > Here are the list of macros and variables from 'intrpvar.h' file that
> > are just defined in perl module but not in plperl on Windows,
> 
> > #ifdef PERL_USES_PL_PIDSTATUS
> > PERLVAR(I, pidstatus,   HV *)       /* pid-to-status mappings for waitpid */
> > #endif
> 
> > #ifdef PERL_SAWAMPERSAND
> > PERLVAR(I, sawampersand, U8)        /* must save all match strings */
> > #endif
> 
> I am really suspicious that this means your libperl was built in an unsafe
> fashion, that is, by injecting configuration choices as random -D switches
> in the build process rather than making sure the choices were recorded in
> perl's config.h.  As an example, looking at the perl 5.24.1 headers on
> a Fedora box, it looks to me like PERL_SAWAMPERSAND could only get defined
> if PERL_COPY_ON_WRITE were not defined, and the only way that that can
> happen is if PERL_NO_COW is defined, and there are no references to the
> latter anyplace except in this particular #if defined test in perl.h.
> 
> Where did your perl installation come from, anyway?  Are you sure the .h
> files match up with the executables?

I see corresponding symptoms with the following Perl distributions:

strawberry-perl-5.26.0.1-64bit.msi:
  src/pl/plperl/Util.c: loadable library and perl binaries are mismatched (got handshake key 0000000011800080, needed 0000000011c00080)
ActivePerl-5.24.1.2402-MSWin32-x64-401627.exe:
  src/pl/plperl/Util.c: loadable library and perl binaries are mismatched (got handshake key 0000000011500080, needed 0000000011900080)

So, this affects each of the two prominent families of Perl Windows binaries.
Notes for anyone trying to reproduce:

- Both of those Perl distributions require the hacks described here:
  https://www.postgresql.org/message-id/flat/CABcP5fjEjgOsh097cWnQrsK9yCswo4DZxp-V47DKCH-MxY9Gig%40mai...
- Add PERL_USE_UNSAFE_INC=1 to the environment until we update things to cope
  with this Perl 5.26 change:
  http://search.cpan.org/~xsawyerx/perl-5.26.0/pod/perldelta.pod#Removal_of_the_current_directory_(%22...


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-24 06:28                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2017-07-25 12:58                           ` Amit Kapila <amit.kapila16@gmail.com>
  2017-07-25 14:37                             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-25 14:38                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 94+ messages in thread

From: Amit Kapila @ 2017-07-25 12:58 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Mon, Jul 24, 2017 at 11:58 AM, Noah Misch <noah@leadboat.com> wrote:
> On Wed, Jul 19, 2017 at 05:01:31PM -0400, Tom Lane wrote:
>> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> > Here are the list of macros and variables from 'intrpvar.h' file that
>> > are just defined in perl module but not in plperl on Windows,
>>
>> > #ifdef PERL_USES_PL_PIDSTATUS
>> > PERLVAR(I, pidstatus,   HV *)       /* pid-to-status mappings for waitpid */
>> > #endif
>>
>> > #ifdef PERL_SAWAMPERSAND
>> > PERLVAR(I, sawampersand, U8)        /* must save all match strings */
>> > #endif
>>
>> I am really suspicious that this means your libperl was built in an unsafe
>> fashion, that is, by injecting configuration choices as random -D switches
>> in the build process rather than making sure the choices were recorded in
>> perl's config.h.  As an example, looking at the perl 5.24.1 headers on
>> a Fedora box, it looks to me like PERL_SAWAMPERSAND could only get defined
>> if PERL_COPY_ON_WRITE were not defined, and the only way that that can
>> happen is if PERL_NO_COW is defined, and there are no references to the
>> latter anyplace except in this particular #if defined test in perl.h.
>>
>> Where did your perl installation come from, anyway?  Are you sure the .h
>> files match up with the executables?
>
> I see corresponding symptoms with the following Perl distributions:
>
> strawberry-perl-5.26.0.1-64bit.msi:
>   src/pl/plperl/Util.c: loadable library and perl binaries are mismatched (got handshake key 0000000011800080, needed 0000000011c00080)
> ActivePerl-5.24.1.2402-MSWin32-x64-401627.exe:
>   src/pl/plperl/Util.c: loadable library and perl binaries are mismatched (got handshake key 0000000011500080, needed 0000000011900080)
>
> So, this affects each of the two prominent families of Perl Windows binaries.
>

I think the real question is where do we go from here.  Ashutosh has
proposed a patch up-thread based on a suggestion from Andrew, but it
is not clear if we want to go there as that seems to be bypassing
handshake mechanism.  The other tests and analysis seem to indicate
that the new version Perl binaries on Windows are getting built with
flags that are incompatible with what we use for plperl and it is not
clear why perl is using those flags.  Do you think we can do something
at our end to make it work or someone should check with Perl community
about it?

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-24 06:28                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-07-25 12:58                           ` Re: pl/perl extension fails on Windows Amit Kapila <amit.kapila16@gmail.com>
@ 2017-07-25 14:37                             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-25 14:50                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-25 14:37 UTC (permalink / raw)
  To: Amit Kapila <amit.kapila16@gmail.com>; Noah Misch <noah@leadboat.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/25/2017 08:58 AM, Amit Kapila wrote:
>
> I think the real question is where do we go from here.  Ashutosh has
> proposed a patch up-thread based on a suggestion from Andrew, but it
> is not clear if we want to go there as that seems to be bypassing
> handshake mechanism.  The other tests and analysis seem to indicate
> that the new version Perl binaries on Windows are getting built with
> flags that are incompatible with what we use for plperl and it is not
> clear why perl is using those flags.  Do you think we can do something
> at our end to make it work or someone should check with Perl community
> about it?
>


No amount of checking with the Perl community is likely to resolve this
quickly w.r.t. existing releases of Perl.

We seem to have a choice either to abandon, at least temporarily, perl
support on Windows for versions of perl >= 5.20 (I think) or adopt the
suggestion I made. It's not a complete hack - it's something at least
somewhat blessed in perl's XSUB.h:

    /* dXSBOOTARGSNOVERCHK has no API in xsubpp to choose it so do
    #undef dXSBOOTARGSXSAPIVERCHK
    #define dXSBOOTARGSXSAPIVERCHK dXSBOOTARGSNOVERCHK */


Note that on earlier versions of perl we got by without this check for
years without any issue or complaint I recall hearing of. If we don't
adopt this I would not be at all surprised to see Windows packagers
adopt it anyway.

cheers

andrew



-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-24 06:28                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-07-25 12:58                           ` Re: pl/perl extension fails on Windows Amit Kapila <amit.kapila16@gmail.com>
  2017-07-25 14:37                             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-07-25 14:50                               ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-25 14:50 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Amit Kapila <amit.kapila16@gmail.com>; Noah Misch <noah@leadboat.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> No amount of checking with the Perl community is likely to resolve this
> quickly w.r.t. existing releases of Perl.

Yes, but if they are shipping broken perl builds that cannot support
building of extension modules, they need to be made aware of that.
If that *isn't* the explanation, then we need to find out what is.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-24 06:28                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-07-25 12:58                           ` Re: pl/perl extension fails on Windows Amit Kapila <amit.kapila16@gmail.com>
@ 2017-07-25 14:38                             ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-25 14:38 UTC (permalink / raw)
  To: Amit Kapila <amit.kapila16@gmail.com>; +Cc: Noah Misch <noah@leadboat.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Amit Kapila <amit.kapila16@gmail.com> writes:
> I think the real question is where do we go from here.  Ashutosh has
> proposed a patch up-thread based on a suggestion from Andrew, but it
> is not clear if we want to go there as that seems to be bypassing
> handshake mechanism.

That definitely seems like the wrong route to me.  If the resulting
code works, it would at best be accidental.

> The other tests and analysis seem to indicate
> that the new version Perl binaries on Windows are getting built with
> flags that are incompatible with what we use for plperl and it is not
> clear why perl is using those flags.  Do you think we can do something
> at our end to make it work or someone should check with Perl community
> about it?

It would be a good idea to find somebody who knows more about how these
Perl distros are built.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-25 14:23                         ` Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:00                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  1 sibling, 2 replies; 94+ messages in thread

From: Robert Haas @ 2017-07-25 14:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Wed, Jul 19, 2017 at 5:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I am really suspicious that this means your libperl was built in an unsafe
> fashion, that is, by injecting configuration choices as random -D switches
> in the build process rather than making sure the choices were recorded in
> perl's config.h.  As an example, looking at the perl 5.24.1 headers on
> a Fedora box, it looks to me like PERL_SAWAMPERSAND could only get defined
> if PERL_COPY_ON_WRITE were not defined, and the only way that that can
> happen is if PERL_NO_COW is defined, and there are no references to the
> latter anyplace except in this particular #if defined test in perl.h.

Hmm, it might not be so random as all that.  Have a look at this
commit log entry:

commit 1a904fc88069e249a4bd0ef196a3f1a7f549e0fe
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Sun Nov 25 12:57:04 2012 -0800

    Disable PL_sawampersand

    PL_sawampersand actually causes bugs (e.g., perl #4289), because the
    behaviour changes.  eval '$&' after a match will produce different
    results depending on whether $& was seen before the match.

    Using copy-on-write for the pre-match copy (preceding patches do that)
    alleviates the slowdown caused by mentioning $&.  The copy doesn’t
    happen unless the string is modified after the match.  It’s now a
    post- match copy.  So we no longer need to do things differently
    depending on whether $& has been seen.

    PL_sawampersand is now #defined to be equal to what it would be if
    every program began with $',$&,$`.

    I left the PL_sawampersand code in place, in case this commit proves
    immature.  Running Configure with -Accflags=PERL_SAWAMPERSAND will
    reënable the PL_sawampersand mechanism.

Based on a bit of experimentation, that last bit contains a typo: it
should say -Accflags=-DPERL_SAWAMPERSAND; as written, the -D is
missing.[1] Anyway, the point is that at least in this case, there
seems to have been some idea that somebody might want to reenable this
in their own build even after it was disabled by default.

Perl also has a mechanism for flags added to Configure to be passed
along when building loadable modules; if it didn't, not just plperl
but every Perl module written in C would have this issue if any such
flags where used.  Normally, you compile perl modules by running "perl
Makefile.PL" to generate a makefile, and then building from the
makefile.  If you do that, then the Makefile ends up with a section in
it that looks like this:

# --- MakeMaker cflags section:

CCFLAGS = -fno-strict-aliasing -pipe -fstack-protector-strong
-I/opt/local/include -DPERL_USE_SAFE_PUTENV -DPERL_SAWAMPERSAND -Wall
-Werror=declaration-after-statement -Wextra -Wc++-compat
-Wwrite-strings
OPTIMIZE = -O3
PERLTYPE =
MPOLLUTE =

...and lo-and-behold, the -DPERL_SAWAMPERSAND flag which I passed to
Configure is there.   After a bit of time deciphering how MakeMaker
actually works, I figured out that it gets the value for CFLAGS by
doing "use Config;" and then referencing $Config::Config{'ccflags'};
an alternative way to get it, from the shell, is to run perl
-V:ccflags.

While I'm not sure of the details, I suspect that we need to use one
of those methods to get the CCFLAGS used to build perl, and include
those when SPI.o, Util.o, and plperl.o in src/pl/plperl.  Or at least
the -D switches from those CCFLAGS.  Here's about the simplest thing
that seems like it might work on Linux; Windows would need something
equivalent:

override CPPFLAGS += $(shell $(PERL) -MConfig -e 'print
$$Config::Config{"ccflags"};')

On my MacBook Pro, with the built-in switches, that produces:

-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -pipe -Os
-fno-strict-aliasing -fstack-protector-strong -I/opt/local/include
-DPERL_USE_SAFE_PUTENV

Or we could try to extract just the -D switches:

override CPPFLAGS += $(shell $(PERL) -MConfig -e 'print join " ", grep
{ /^-D/ } split /\s+/, $$Config::Config{"ccflags"};')

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

[1] Arguably, the umlaut over "reenable" is also a typo, but that's a
sort of in a different category.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-07-25 15:00                           ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 15:14                             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-25 15:26                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  1 sibling, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-25 15:00 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> Perl also has a mechanism for flags added to Configure to be passed
> along when building loadable modules; if it didn't, not just plperl
> but every Perl module written in C would have this issue if any such
> flags where used.
> ...
> While I'm not sure of the details, I suspect that we need to use one
> of those methods to get the CCFLAGS used to build perl, and include
> those when SPI.o, Util.o, and plperl.o in src/pl/plperl.  Or at least
> the -D switches from those CCFLAGS.

Hm, I had the idea that we were already asking ExtUtils::Embed for that,
but now I see we only inquire about LDFLAGS not CCFLAGS.  Yes, this sounds
like a promising avenue to pursue.

It would be useful to see the results of

perl -MExtUtils::Embed -e ccopts

on one of the affected installations, and compare that to the problematic
field(s).

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:00                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-25 15:14                             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-25 15:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/25/2017 11:00 AM, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Perl also has a mechanism for flags added to Configure to be passed
>> along when building loadable modules; if it didn't, not just plperl
>> but every Perl module written in C would have this issue if any such
>> flags where used.
>> ...
>> While I'm not sure of the details, I suspect that we need to use one
>> of those methods to get the CCFLAGS used to build perl, and include
>> those when SPI.o, Util.o, and plperl.o in src/pl/plperl.  Or at least
>> the -D switches from those CCFLAGS.
> Hm, I had the idea that we were already asking ExtUtils::Embed for that,
> but now I see we only inquire about LDFLAGS not CCFLAGS.  Yes, this sounds
> like a promising avenue to pursue.
>
> It would be useful to see the results of
>
> perl -MExtUtils::Embed -e ccopts
>
> on one of the affected installations, and compare that to the problematic
> field(s).

  -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS
-DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv
-fno-strict-aliasing -mms-bitfields  -I"C:\Perl64\lib\CORE"

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:00                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-25 15:26                             ` Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:32                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Robert Haas @ 2017-07-25 15:26 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Tue, Jul 25, 2017 at 11:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Hm, I had the idea that we were already asking ExtUtils::Embed for that,
> but now I see we only inquire about LDFLAGS not CCFLAGS.  Yes, this sounds
> like a promising avenue to pursue.
>
> It would be useful to see the results of
>
> perl -MExtUtils::Embed -e ccopts
>
> on one of the affected installations, and compare that to the problematic
> field(s).

Why ccopts rather than ccflags?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:00                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 15:26                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-07-25 15:32                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 15:39                                 ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:39                                 ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-25 15:32 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Jul 25, 2017 at 11:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hm, I had the idea that we were already asking ExtUtils::Embed for that,
>> but now I see we only inquire about LDFLAGS not CCFLAGS.  Yes, this sounds
>> like a promising avenue to pursue.
>> 
>> It would be useful to see the results of
>> perl -MExtUtils::Embed -e ccopts
>> on one of the affected installations, and compare that to the problematic
>> field(s).

> Why ccopts rather than ccflags?

I was looking at the current code which fetches ldopts, and analogizing.
Don't know the difference between ccflags and ccopts.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:00                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 15:26                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:32                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-25 15:39                                 ` Robert Haas <robertmhaas@gmail.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Robert Haas @ 2017-07-25 15:39 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Tue, Jul 25, 2017 at 11:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Tue, Jul 25, 2017 at 11:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Hm, I had the idea that we were already asking ExtUtils::Embed for that,
>>> but now I see we only inquire about LDFLAGS not CCFLAGS.  Yes, this sounds
>>> like a promising avenue to pursue.
>>>
>>> It would be useful to see the results of
>>> perl -MExtUtils::Embed -e ccopts
>>> on one of the affected installations, and compare that to the problematic
>>> field(s).
>
>> Why ccopts rather than ccflags?
>
> I was looking at the current code which fetches ldopts, and analogizing.
> Don't know the difference between ccflags and ccopts.

Oh, here I was thinking you were 3 steps ahead of me.  :-)

Per "perldoc ExtUtils::Embed", ccopts() = perl_inc() plus ccflags()
plus ccdlflags().

On my system:

[rhaas pgsql]$ perl -MExtUtils::Embed -e 'for (qw(ccopts ccflags
ccdlflags perl_inc)) { print "==$_==\n"; eval "$_()"; print "\n\n";
};'
==ccopts==
 -fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -pipe -Os
-fno-strict-aliasing -fstack-protector-strong -I/opt/local/include
-DPERL_USE_SAFE_PUTENV
-I/opt/local/lib/perl5/5.24/darwin-thread-multi-2level/CORE

==ccflags==
 -fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -pipe -Os
-fno-strict-aliasing -fstack-protector-strong -I/opt/local/include
-DPERL_USE_SAFE_PUTENV

==ccdlflags==


==perl_inc==
 -I/opt/local/lib/perl5/5.24/darwin-thread-multi-2level/CORE

I don't have a clear sense of whether ccopts() or ccflags() is what we
want here, but FWIW ccopts() is more inclusive.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:00                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 15:26                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-25 15:32                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-25 15:39                                 ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-25 15:39 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/25/2017 11:32 AM, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Tue, Jul 25, 2017 at 11:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Hm, I had the idea that we were already asking ExtUtils::Embed for that,
>>> but now I see we only inquire about LDFLAGS not CCFLAGS.  Yes, this sounds
>>> like a promising avenue to pursue.
>>>
>>> It would be useful to see the results of
>>> perl -MExtUtils::Embed -e ccopts
>>> on one of the affected installations, and compare that to the problematic
>>> field(s).
>> Why ccopts rather than ccflags?
> I was looking at the current code which fetches ldopts, and analogizing.
> Don't know the difference between ccflags and ccopts.
>
> 			


per docs:

    ccopts()
            This function combines "perl_inc()", "ccflags()" and
    "ccdlflags()"
            into one.

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-07-26 03:08                           ` Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Robert Haas @ 2017-07-26 03:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Tue, Jul 25, 2017 at 10:23 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> While I'm not sure of the details, I suspect that we need to use one
> of those methods to get the CCFLAGS used to build perl, and include
> those when SPI.o, Util.o, and plperl.o in src/pl/plperl.  Or at least
> the -D switches from those CCFLAGS.  Here's about the simplest thing
> that seems like it might work on Linux; Windows would need something
> equivalent:
>
> override CPPFLAGS += $(shell $(PERL) -MConfig -e 'print
> $$Config::Config{"ccflags"};')
>
> On my MacBook Pro, with the built-in switches, that produces:
>
> -fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -pipe -Os
> -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include
> -DPERL_USE_SAFE_PUTENV
>
> Or we could try to extract just the -D switches:
>
> override CPPFLAGS += $(shell $(PERL) -MConfig -e 'print join " ", grep
> { /^-D/ } split /\s+/, $$Config::Config{"ccflags"};')

Based on discussion downthread, it seems like what we actually need to
do is update perl.m4 to extract CCFLAGS.  Turns out somebody proposed
a patch for that back in 2002:

https://www.postgresql.org/message-id/Pine.LNX.4.44.0211051045070.16317-200000%40wotan.suse.de

It seems to need a rebase.  :-)

And maybe some other changes, too.  I haven't carefully reviewed that thread.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-07-26 03:21                             ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-26 03:21 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> Based on discussion downthread, it seems like what we actually need to
> do is update perl.m4 to extract CCFLAGS.  Turns out somebody proposed
> a patch for that back in 2002:
> https://www.postgresql.org/message-id/Pine.LNX.4.44.0211051045070.16317-200000%40wotan.suse.de
> It seems to need a rebase.  :-)

Ah-hah, I *thought* we had considered the question once upon a time.
There were some pretty substantial compatibility concerns raised in that
thread, which is doubtless why it's still like that.

My beef about inter-compiler compatibility (if building PG with a
different compiler from that used for Perl) could probably be addressed by
absorbing only -D switches from the Perl flags.  But Peter seemed to feel
that even that could break things, and I worry that he's right for cases
like -D_FILE_OFFSET_BITS which affect libc APIs.  Usually we'd have made
the same decisions as Perl for that sort of thing, but if we didn't, it's
a mess.

I wonder whether we could adopt some rule like "absorb -D switches
for macros whose names do not begin with an underscore".  That's
surely a hack and three-quarters, but it seems safer than just
absorbing everything willy-nilly.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-26 14:26                               ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 13:08                                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-26 14:26 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Wed, Jul 26, 2017 at 8:51 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Based on discussion downthread, it seems like what we actually need to
>> do is update perl.m4 to extract CCFLAGS.  Turns out somebody proposed
>> a patch for that back in 2002:
>> https://www.postgresql.org/message-id/Pine.LNX.4.44.0211051045070.16317-200000%40wotan.suse.de
>> It seems to need a rebase.  :-)
>
> Ah-hah, I *thought* we had considered the question once upon a time.
> There were some pretty substantial compatibility concerns raised in that
> thread, which is doubtless why it's still like that.
>
> My beef about inter-compiler compatibility (if building PG with a
> different compiler from that used for Perl) could probably be addressed by
> absorbing only -D switches from the Perl flags.  But Peter seemed to feel
> that even that could break things, and I worry that he's right for cases
> like -D_FILE_OFFSET_BITS which affect libc APIs.  Usually we'd have made
> the same decisions as Perl for that sort of thing, but if we didn't, it's
> a mess.
>
> I wonder whether we could adopt some rule like "absorb -D switches
> for macros whose names do not begin with an underscore".  That's
> surely a hack and three-quarters, but it seems safer than just
> absorbing everything willy-nilly.
>

Thanks Robert, Tom, Andrew and Amit for all your inputs. I have tried
to work on the patch shared by Reinhard  long time back for Linux. I
had to rebase the patch and also had to do add some more lines of code
to make it work on Linux. For Windows, I had to prepare a separate
patch to replicate similar behaviour.  I can see that both these
patches are working as expected i.e they are able import the switches
used by Perl into plperl module during build time.  However, on
windows i am still seeing the crash and i am still working to find the
reason for this.  Here, I attach the patches that i have prepared for
linux and Windows platforms. Thanks.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

plperl_linux.patch (application/octet-stream, 2.9K) download diff --git a/config/perl.m4 b/config/perl.m4 index bed2eae..d2ac2ef 100644 --- a/config/perl.m4 +++ b/config/perl.m4 @@ -49,6 +49,16 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS], [m4_foreach([pgac_item], [$1], [PGAC_CHECK_PERL_CONFIG(pgac_item)])]) +# PGAC_CHECK_PERL_EMBED_CCFLAGS +# ----------------------------- +AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS], +[AC_REQUIRE([PGAC_PATH_PERL]) +AC_MSG_CHECKING([for CFLAGS to compile embedded Perl]) +perl_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {if ($f =~ /^-D/) {print $f, " "}}'` +AC_SUBST(perl_ccflags)dnl +AC_MSG_RESULT([$perl_ccflags])]) + + # PGAC_CHECK_PERL_EMBED_LDFLAGS # ----------------------------- # We are after Embed's ldopts, but without the subset mentioned in diff --git a/configure b/configure index aff72eb..1e6bf86 100755 --- a/configure +++ b/configure @@ -667,6 +667,7 @@ python_includespec python_version python_majorversion PYTHON +perl_ccflags perl_embed_ldflags perl_useshrplib perl_privlibexp @@ -7767,6 +7768,19 @@ documentation for details. Use --without-perl to disable building PL/Perl." "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ccflags for embedded Perl" >&5 +$as_echo_n "checking for ccflags for embedded Perl... " >&6; } + +perl_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {if ($f =~ /^-D/) {print $f, " "}}'` + +if test -z "$perl_ccflags" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_ccflags" >&5 +$as_echo "$perl_ccflags" >&6; } +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flags to link embedded Perl" >&5 $as_echo_n "checking for flags to link embedded Perl... " >&6; } if test "$PORTNAME" = "win32" ; then diff --git a/configure.in b/configure.in index 72e5b17..13c69d6 100644 --- a/configure.in +++ b/configure.in @@ -938,6 +938,7 @@ You might have to rebuild your Perl installation. Refer to the documentation for details. Use --without-perl to disable building PL/Perl.]) fi + PGAC_CHECK_PERL_EMBED_CCFLAGS PGAC_CHECK_PERL_EMBED_LDFLAGS fi diff --git a/src/Makefile.global.in b/src/Makefile.global.in index dc8a89a..ff1c185 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -304,6 +304,7 @@ else endif perl_archlibexp = @perl_archlibexp@ perl_privlibexp = @perl_privlibexp@ +perl_ccflags = @perl_ccflags@ perl_embed_ldflags = @perl_embed_ldflags@ # Miscellaneous diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile index b8e3585..dce0513 100644 --- a/src/pl/plperl/GNUmakefile +++ b/src/pl/plperl/GNUmakefile @@ -12,7 +12,7 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID override CPPFLAGS += -Wno-comment endif -override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE +override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE $(perl_ccflags) rpathdir = $(perl_archlibexp)/CORE
plperl_win.patch (application/octet-stream, 593B) download diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index e0bf607..0f50fde 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -518,6 +518,15 @@ sub mkvcbuild $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl'); $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE'); $plperl->AddDefine('PLPERL_HAVE_UID_GID'); + + foreach my $f (split(" ",$Config{ccflags})) + { + if ($f =~ /^-D/) + { + $plperl->AddDefine($f); + } + } + foreach my $xs ('SPI.xs', 'Util.xs') { (my $xsc = $xs) =~ s/\.xs/.c/;
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-27 13:08                                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-27 13:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Hi All,

On Wed, Jul 26, 2017 at 7:56 PM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> On Wed, Jul 26, 2017 at 8:51 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
>>> Based on discussion downthread, it seems like what we actually need to
>>> do is update perl.m4 to extract CCFLAGS.  Turns out somebody proposed
>>> a patch for that back in 2002:
>>> https://www.postgresql.org/message-id/Pine.LNX.4.44.0211051045070.16317-200000%40wotan.suse.de
>>> It seems to need a rebase.  :-)
>>
>> Ah-hah, I *thought* we had considered the question once upon a time.
>> There were some pretty substantial compatibility concerns raised in that
>> thread, which is doubtless why it's still like that.
>>
>> My beef about inter-compiler compatibility (if building PG with a
>> different compiler from that used for Perl) could probably be addressed by
>> absorbing only -D switches from the Perl flags.  But Peter seemed to feel
>> that even that could break things, and I worry that he's right for cases
>> like -D_FILE_OFFSET_BITS which affect libc APIs.  Usually we'd have made
>> the same decisions as Perl for that sort of thing, but if we didn't, it's
>> a mess.
>>
>> I wonder whether we could adopt some rule like "absorb -D switches
>> for macros whose names do not begin with an underscore".  That's
>> surely a hack and three-quarters, but it seems safer than just
>> absorbing everything willy-nilly.
>>
>
> Thanks Robert, Tom, Andrew and Amit for all your inputs. I have tried
> to work on the patch shared by Reinhard  long time back for Linux. I
> had to rebase the patch and also had to do add some more lines of code
> to make it work on Linux. For Windows, I had to prepare a separate
> patch to replicate similar behaviour.  I can see that both these
> patches are working as expected i.e they are able import the switches
> used by Perl into plperl module during build time.  However, on
> windows i am still seeing the crash and i am still working to find the
> reason for this.  Here, I attach the patches that i have prepared for
> linux and Windows platforms. Thanks.

There was a small problem with my patch for windows that i had
submitted yesterday. It was reading the switches in '-D*' form and
including those as it is in the plperl build. Infact, it should be
removing '-D' option (from say -DPERL_CORE) and just add the macro
name (PERL_CORE) to the define list using AddDefine('PERL_CORE').
Anyways, attached is the patch that corrects this issue. The patch now
imports all the switches used by perl into plperl module but, after
doing so, i am seeing some compilation errors on Windows. Following is
the error observed,

SPI.obj : error LNK2019: unresolved external symbol PerlProc_setjmp
referenced in function do_plperl_return_next

I did some analysis in order to find the reason for this error and
could see that for Windows, sigsetjmp is defined as setjmp in PG. But,
setjmp is also defined by Perl. Hence, after including perl header
files, setjmp gets redefined as 'PerlProc_setjmp'.

In short, we have 'src/pl/plperl/SPI.c' file including 'perl.h'
followed 'XSUB.h'. perl.h defines PerlProc_setjmp() as,

#define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))

and Sigsetjmp is defined as:

#define Sigsetjmp(buf,save_mask) setjmp((buf))

Then XSUB.h redefines setjmp as:

# define setjmp PerlProc_setjmp

which basically creates a loop in the preprocessor definitions.

Another problem with setjmp() redefinition is that setjmp takes one
argument whereas PerlProc_setjmp takes two arguments.

To fix this compilation error i have removed the setjmp() redefinition
from XSUB.h in perl and after doing that the build succeeds and also
'create language plperl' command is working fine i.e. there is no more
server crash.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

plperl_win_v2.patch (application/octet-stream, 895B) download From 518bdc92b619b4d1c906431854e9728ddc955474 Mon Sep 17 00:00:00 2001 From: Ashutosh <ashu.coek@gmail.com> Date: Thu, 27 Jul 2017 18:24:19 +0530 Subject: [PATCH] Windows fix --- src/tools/msvc/Mkvcbuild.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index e0bf607..f1a991b 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -518,6 +518,16 @@ sub mkvcbuild $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl'); $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE'); $plperl->AddDefine('PLPERL_HAVE_UID_GID'); + + foreach my $f (split(" ",$Config{ccflags})) + { + if ($f =~ /^-D/) + { + $f =~ s/\-D//; + $plperl->AddDefine($f); + } + } + foreach my $xs ('SPI.xs', 'Util.xs') { (my $xsc = $xs) =~ s/\.xs/.c/; -- 2.10.2.windows.1
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-27 14:21                                 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 16:34                                   ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  1 sibling, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-27 14:21 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> Anyways, attached is the patch that corrects this issue. The patch now
> imports all the switches used by perl into plperl module but, after
> doing so, i am seeing some compilation errors on Windows. Following is
> the error observed,

> SPI.obj : error LNK2019: unresolved external symbol PerlProc_setjmp
> referenced in function do_plperl_return_next

That's certainly a mess, but how come that wasn't happening before?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-27 16:34                                   ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 18:36                                     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-27 16:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Thu, Jul 27, 2017 at 7:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> Anyways, attached is the patch that corrects this issue. The patch now
>> imports all the switches used by perl into plperl module but, after
>> doing so, i am seeing some compilation errors on Windows. Following is
>> the error observed,
>
>> SPI.obj : error LNK2019: unresolved external symbol PerlProc_setjmp
>> referenced in function do_plperl_return_next
>
> That's certainly a mess, but how come that wasn't happening before?

Earlier we were using Perl-5.20 version which i think didn't have
handshaking mechanism. From perl-5.22 onwards, the functions like
Perl_xs_handshake() or HS_KEY were introduced for handshaking purpose and
to ensure that the handshaking between plperl and perl doesn't fail, we are
now trying to import the switches used by  perl into plperl. As a result of
this, macros like PERL_IMPLICIT_SYS is getting defined in plperl which
eventually opens the following definitions from XSUB.h resulting in the
compilation error.

   499 #if defined(PERL_IMPLICIT_SYS) && !defined(PERL_CORE)
    518 #    undef ioctl
    519 #    undef getlogin
    520* #    undef setjmp*
    ...........
    ...........

    651 #    define times               PerlProc_times
    652 #    define wait                PerlProc_wait
    653

*#    define setjmp              PerlProc_setjmp*
--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com
>
>                         regards, tom lane

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 16:34                                   ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-27 18:36                                     ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-27 18:46                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-27 18:36 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/27/2017 12:34 PM, Ashutosh Sharma wrote:
> On Thu, Jul 27, 2017 at 7:51 PM, Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>> wrote:
> > Ashutosh Sharma <ashu.coek88@gmail.com
> <mailto:ashu.coek88@gmail.com>> writes:
> >> Anyways, attached is the patch that corrects this issue. The patch now
> >> imports all the switches used by perl into plperl module but, after
> >> doing so, i am seeing some compilation errors on Windows. Following is
> >> the error observed,
> >
> >> SPI.obj : error LNK2019: unresolved external symbol PerlProc_setjmp
> >> referenced in function do_plperl_return_next
> >
> > That's certainly a mess, but how come that wasn't happening before?
>
> Earlier we were using Perl-5.20 version which i think didn't have
> handshaking mechanism. From perl-5.22 onwards, the functions like
> Perl_xs_handshake() or HS_KEY were introduced for handshaking purpose
> and to ensure that the handshaking between plperl and perl doesn't
> fail, we are now trying to import the switches used by  perl into
> plperl. As a result of this, macros like PERL_IMPLICIT_SYS is getting
> defined in plperl which eventually opens the following definitions
> from XSUB.h resulting in the compilation error.
>
>    499 #if defined(PERL_IMPLICIT_SYS) && !defined(PERL_CORE)
>     518 #    undef ioctl
>     519 #    undef getlogin
>     520*#    undef setjmp*
>     ...........
>     ...........
>
>     651 #    define times               PerlProc_times
>     652 #    define wait                PerlProc_wait
>     653 *#    define setjmp              PerlProc_setjmp
>
> *



What is the minimal set of extra defines required to sort out the
handshake fingerprint issue?

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 16:34                                   ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 18:36                                     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-07-27 18:46                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-27 18:46 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> What is the minimal set of extra defines required to sort out the
> handshake fingerprint issue?

Also, exactly what defines do you end up importing in your test build?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-27 20:14                                   ` Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Robert Haas @ 2017-07-27 20:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Thu, Jul 27, 2017 at 10:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> Anyways, attached is the patch that corrects this issue. The patch now
>> imports all the switches used by perl into plperl module but, after
>> doing so, i am seeing some compilation errors on Windows. Following is
>> the error observed,
>
>> SPI.obj : error LNK2019: unresolved external symbol PerlProc_setjmp
>> referenced in function do_plperl_return_next
>
> That's certainly a mess, but how come that wasn't happening before?

How about we fix it like this?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

pg-sigsetjmp.patch (application/octet-stream, 7.6K) download diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 00b1e823af..9facfd4ee3 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -506,7 +506,7 @@ AutoVacLauncherMain(int argc, char *argv[]) * * This code is a stripped down version of PostgresMain error recovery. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* since not using PG_TRY, must reset error stack by hand */ error_context_stack = NULL; @@ -1576,7 +1576,7 @@ AutoVacWorkerMain(int argc, char *argv[]) * * See notes in postgres.c about the design of this coding. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* Prevents interrupts while cleaning up */ HOLD_INTERRUPTS(); diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c index 28af6f0f07..8238d721f3 100644 --- a/src/backend/postmaster/bgworker.c +++ b/src/backend/postmaster/bgworker.c @@ -767,7 +767,7 @@ StartBackgroundWorker(void) * * See notes in postgres.c about the design of this coding. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* Since not using PG_TRY, must reset error stack by hand */ error_context_stack = NULL; diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index 9ad74ee977..8b1596c658 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -171,7 +171,7 @@ BackgroundWriterMain(void) * * See notes in postgres.c about the design of this coding. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* Since not using PG_TRY, must reset error stack by hand */ error_context_stack = NULL; @@ -268,7 +268,7 @@ BackgroundWriterMain(void) { /* * From here on, elog(ERROR) should end with exit(1), not send - * control back to the sigsetjmp block above + * control back to the pg_sigsetjmp block above */ ExitOnAnyError = true; /* Normal exit from the bgwriter is here */ diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index e48ebd557f..682446e764 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -253,7 +253,7 @@ CheckpointerMain(void) * * See notes in postgres.c about the design of this coding. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* Since not using PG_TRY, must reset error stack by hand */ error_context_stack = NULL; @@ -392,7 +392,7 @@ CheckpointerMain(void) { /* * From here on, elog(ERROR) should end with exit(1), not send - * control back to the sigsetjmp block above + * control back to the pg_sigsetjmp block above */ ExitOnAnyError = true; /* Close down the database */ diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c index 7b89e02428..4394b1e260 100644 --- a/src/backend/postmaster/walwriter.c +++ b/src/backend/postmaster/walwriter.c @@ -151,7 +151,7 @@ WalWriterMain(void) * * This code is heavily based on bgwriter.c, q.v. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* Since not using PG_TRY, must reset error stack by hand */ error_context_stack = NULL; diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index b8d860ebdb..67a72769fb 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -3822,15 +3822,15 @@ PostgresMain(int argc, char *argv[], * during error recovery. (If we get into an infinite loop thereby, it * will soon be stopped by overflow of elog.c's internal state stack.) * - * Note that we use sigsetjmp(..., 1), so that this function's signal mask - * (to wit, UnBlockSig) will be restored when longjmp'ing to here. This - * is essential in case we longjmp'd out of a signal handler on a platform - * where that leaves the signal blocked. It's not redundant with the - * unblock in AbortTransaction() because the latter is only called if we - * were inside a transaction. + * Note that we use pg_sigsetjmp(..., 1), so that this function's signal + * mask (to wit, UnBlockSig) will be restored when longjmp'ing to here. + * This is essential in case we longjmp'd out of a signal handler on a + * platform where that leaves the signal blocked. It's not redundant with + * the unblock in AbortTransaction() because the latter is only called if + * we were inside a transaction. */ - if (sigsetjmp(local_sigjmp_buf, 1) != 0) + if (pg_sigsetjmp(local_sigjmp_buf, 1) != 0) { /* * NOTE: if you are tempted to add more code in this if-block, diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l index f01b814c6e..93caeb3c48 100644 --- a/src/backend/utils/misc/guc-file.l +++ b/src/backend/utils/misc/guc-file.l @@ -704,7 +704,7 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, int errorcount; int token; - if (sigsetjmp(flex_fatal_jmp, 1) == 0) + if (pg_sigsetjmp(flex_fatal_jmp, 1) == 0) GUC_flex_fatal_jmp = &flex_fatal_jmp; else { diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 4e04459d45..b9f5946e25 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -4423,7 +4423,7 @@ do_watch(PQExpBuffer query_buf, double sleep) * through the loop since it's conceivable something inside * PSQLexecWatch could change sigint_interrupt_jmp. */ - if (sigsetjmp(sigint_interrupt_jmp, 1) != 0) + if (pg_sigsetjmp(sigint_interrupt_jmp, 1) != 0) break; /* diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c index 724ea9211a..ab27c4b5ab 100644 --- a/src/bin/psql/copy.c +++ b/src/bin/psql/copy.c @@ -521,7 +521,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary, PGresult **res) * Establish longjmp destination for exiting from wait-for-input. (This is * only effective while sigint_interrupt_enabled is TRUE.) */ - if (sigsetjmp(sigint_interrupt_jmp, 1) != 0) + if (pg_sigsetjmp(sigint_interrupt_jmp, 1) != 0) { /* got here with longjmp */ diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index 0162ee8d2f..d2ebaaabda 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -108,7 +108,7 @@ MainLoop(FILE *source) * must re-do this each time through the loop for safety, since the * jmpbuf might get changed during command execution. */ - if (sigsetjmp(sigint_interrupt_jmp, 1) != 0) + if (pg_sigsetjmp(sigint_interrupt_jmp, 1) != 0) { /* got here with longjmp */ diff --git a/src/include/c.h b/src/include/c.h index 9066e3c578..6a934c7faf 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1086,8 +1086,10 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); */ #ifdef WIN32 #define sigjmp_buf jmp_buf -#define sigsetjmp(x,y) setjmp(x) +#define pg_sigsetjmp(x,y) setjmp(x) #define siglongjmp longjmp +#else +#define pg_sigsetjmp(x,y) sigsetjmp(x,y) #endif #if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 7bfd25a9e9..dc666930b4 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -286,7 +286,7 @@ extern PGDLLIMPORT ErrorContextCallback *error_context_stack; sigjmp_buf *save_exception_stack = PG_exception_stack; \ ErrorContextCallback *save_context_stack = error_context_stack; \ sigjmp_buf local_sigjmp_buf; \ - if (sigsetjmp(local_sigjmp_buf, 0) == 0) \ + if (pg_sigsetjmp(local_sigjmp_buf, 0) == 0) \ { \ PG_exception_stack = &local_sigjmp_buf
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-07-27 20:33                                     ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 21:28                                       ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-27 20:33 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> How about we fix it like this?

That seems pretty invasive; I'm not excited about breaking a lot of
unrelated code (particularly third-party extensions) for plperl's benefit.
Even if we wanted to do that in HEAD, it seems like a nonstarter for
released branches.

An even bigger issue is that if Perl feels free to redefine sigsetjmp,
what other libc calls might they decide to horn in on?

So I was trying to figure a way to not include XSUB.h except in a very
limited part of plperl, like ideally just the .xs files.  It's looking
like that would take nontrivial refactoring though :-(.  Another problem
is that this critical bit of the library API is in XSUB.h:

#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_GET_CONTEXT) && !defined(PERL_CORE)
#  undef aTHX
#  undef aTHX_
#  define aTHX		PERL_GET_THX
#  define aTHX_		aTHX,
#endif

As best I can tell, that's absolute brain death on the part of the Perl
crew; it means you can't write working calling code at all without
including XSUB.h, or at least copying-and-pasting this bit out of it.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-27 21:28                                       ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Andrew Dunstan @ 2017-07-27 21:28 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers



On 07/27/2017 04:33 PM, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> How about we fix it like this?
> That seems pretty invasive; I'm not excited about breaking a lot of
> unrelated code (particularly third-party extensions) for plperl's benefit.
> Even if we wanted to do that in HEAD, it seems like a nonstarter for
> released branches.
>
> An even bigger issue is that if Perl feels free to redefine sigsetjmp,
> what other libc calls might they decide to horn in on?
>
> So I was trying to figure a way to not include XSUB.h except in a very
> limited part of plperl, like ideally just the .xs files.  It's looking
> like that would take nontrivial refactoring though :-(.  Another problem
> is that this critical bit of the library API is in XSUB.h:
>
> #if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_GET_CONTEXT) && !defined(PERL_CORE)
> #  undef aTHX
> #  undef aTHX_
> #  define aTHX		PERL_GET_THX
> #  define aTHX_		aTHX,
> #endif
>
> As best I can tell, that's absolute brain death on the part of the Perl
> crew; it means you can't write working calling code at all without
> including XSUB.h, or at least copying-and-pasting this bit out of it.
>
> 			

That's the sort of thing that prompted me to ask what was the minimal
set of defines required to fix the original problem (assuming such a
thing exists)

We haven't used PERL_IMPLICIT_CONTEXT to date, and without ill effect.
For example. it's in the ExtUtils::Embed::ccopts for the perl that
jacana and bowerbird happily build and test against.

cheers

andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-27 22:50                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-27 22:50 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 07/27/2017 04:33 PM, Tom Lane wrote:
>> So I was trying to figure a way to not include XSUB.h except in a very
>> limited part of plperl, like ideally just the .xs files.  It's looking
>> like that would take nontrivial refactoring though :-(.  Another problem
>> is that this critical bit of the library API is in XSUB.h:

> That's the sort of thing that prompted me to ask what was the minimal
> set of defines required to fix the original problem (assuming such a
> thing exists)
> We haven't used PERL_IMPLICIT_CONTEXT to date, and without ill effect.
> For example. it's in the ExtUtils::Embed::ccopts for the perl that
> jacana and bowerbird happily build and test against.

Well, actually, PERL_IMPLICIT_CONTEXT is turned on automatically in any
MULTIPLICITY build, and since it changes all the Perl ABIs, we *are*
relying on it.  However, after further study of the Perl docs I noticed
that we could dispense with XSUB.h if we defined PERL_NO_GET_CONTEXT
(which turns the quoted stanza into a no-op).  That results in needing to
sprinkle plperl.c with "dTHX" declarations, as explained in perlguts.pod.
They're slightly tricky to place correctly, because they load up a pointer
to the current Perl interpreter, so you have to be wary of where to put
them in functions that change interpreters.  But I seem to have it working
in the attached patch.  (One benefit of doing this extra work is that it
should be a bit more efficient, in that we load up a Perl interpreter
pointer only once per function called, not once per usage therein.  We
could remove many of those fetches too, if we wanted to sprinkle the
plperl code with yet more THX droppings; but I left that for another day.)

Armed with that, I got rid of XSUB.h in plperl.c and moved the
PG_TRY-using functions in the .xs files to plperl.c.  I think this would
fix Ashutosh's problem, though I am not in a position to try it with a
PERL_IMPLICIT_SYS build here.

			regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

avoid-XSUB.h-in-plperl.c-v1.patch (text/x-diff, 22.4K) download diff --git a/src/pl/plperl/SPI.xs b/src/pl/plperl/SPI.xs index 0447c50..7651b62 100644 *** a/src/pl/plperl/SPI.xs --- b/src/pl/plperl/SPI.xs *************** *** 15,52 **** #undef _ /* perl stuff */ #include "plperl.h" #include "plperl_helpers.h" - /* - * Interface routine to catch ereports and punt them to Perl - */ - static void - do_plperl_return_next(SV *sv) - { - MemoryContext oldcontext = CurrentMemoryContext; - - PG_TRY(); - { - plperl_return_next(sv); - } - PG_CATCH(); - { - ErrorData *edata; - - /* Must reset elog.c's state */ - MemoryContextSwitchTo(oldcontext); - edata = CopyErrorData(); - FlushErrorState(); - - /* Punt the error to Perl */ - croak_cstr(edata->message); - } - PG_END_TRY(); - } - - MODULE = PostgreSQL::InServer::SPI PREFIX = spi_ PROTOTYPES: ENABLE --- 15,25 ---- #undef _ /* perl stuff */ + #define PG_NEED_PERL_XSUB_H #include "plperl.h" #include "plperl_helpers.h" MODULE = PostgreSQL::InServer::SPI PREFIX = spi_ PROTOTYPES: ENABLE *************** void *** 76,82 **** spi_return_next(rv) SV *rv; CODE: ! do_plperl_return_next(rv); SV * spi_spi_query(sv) --- 49,55 ---- spi_return_next(rv) SV *rv; CODE: ! plperl_return_next(rv); SV * spi_spi_query(sv) diff --git a/src/pl/plperl/Util.xs b/src/pl/plperl/Util.xs index dbba0d7..862fec4 100644 *** a/src/pl/plperl/Util.xs --- b/src/pl/plperl/Util.xs *************** *** 20,67 **** #undef _ /* perl stuff */ #include "plperl.h" #include "plperl_helpers.h" - /* - * Implementation of plperl's elog() function - * - * If the error level is less than ERROR, we'll just emit the message and - * return. When it is ERROR, elog() will longjmp, which we catch and - * turn into a Perl croak(). Note we are assuming that elog() can't have - * any internal failures that are so bad as to require a transaction abort. - * - * This is out-of-line to suppress "might be clobbered by longjmp" warnings. - */ - static void - do_util_elog(int level, SV *msg) - { - MemoryContext oldcontext = CurrentMemoryContext; - char * volatile cmsg = NULL; - - PG_TRY(); - { - cmsg = sv2cstr(msg); - elog(level, "%s", cmsg); - pfree(cmsg); - } - PG_CATCH(); - { - ErrorData *edata; - - /* Must reset elog.c's state */ - MemoryContextSwitchTo(oldcontext); - edata = CopyErrorData(); - FlushErrorState(); - - if (cmsg) - pfree(cmsg); - - /* Punt the error to Perl */ - croak_cstr(edata->message); - } - PG_END_TRY(); - } static text * sv2text(SV *sv) --- 20,29 ---- #undef _ /* perl stuff */ + #define PG_NEED_PERL_XSUB_H #include "plperl.h" #include "plperl_helpers.h" static text * sv2text(SV *sv) *************** util_elog(level, msg) *** 105,111 **** level = ERROR; if (level < DEBUG5) level = DEBUG5; ! do_util_elog(level, msg); SV * util_quote_literal(sv) --- 67,73 ---- level = ERROR; if (level < DEBUG5) level = DEBUG5; ! plperl_util_elog(level, msg); SV * util_quote_literal(sv) diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 5a45e3e..9a26470 100644 *** a/src/pl/plperl/plperl.c --- b/src/pl/plperl/plperl.c *************** static void plperl_init_shared_libs(pTHX *** 285,290 **** --- 285,291 ---- static void plperl_trusted_init(void); static void plperl_untrusted_init(void); static HV *plperl_spi_execute_fetch_result(SPITupleTable *, uint64, int); + static void plperl_return_next_internal(SV *sv); static char *hek2cstr(HE *he); static SV **hv_store_string(HV *hv, const char *key, SV *val); static SV **hv_fetch_string(HV *hv, const char *key); *************** static char *setlocale_perl(int category *** 303,313 **** --- 304,326 ---- #endif /* + * Decrement the refcount of the given SV within the active Perl interpreter + */ + static inline void + SvREFCNT_dec_current(SV *sv) + { + dTHX; + + SvREFCNT_dec(sv); + } + + /* * convert a HE (hash entry) key to a cstr in the current database encoding */ static char * hek2cstr(HE *he) { + dTHX; char *ret; SV *sv; *************** select_perl_context(bool trusted) *** 641,655 **** * to the database AFTER on_*_init code has run. See * http://archives.postgresql.org/pgsql-hackers/2010-01/msg02669.php */ ! newXS("PostgreSQL::InServer::SPI::bootstrap", ! boot_PostgreSQL__InServer__SPI, __FILE__); ! eval_pv("PostgreSQL::InServer::SPI::bootstrap()", FALSE); ! if (SvTRUE(ERRSV)) ! ereport(ERROR, ! (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), ! errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), ! errcontext("while executing PostgreSQL::InServer::SPI::bootstrap"))); /* Fully initialized, so mark the hashtable entry valid */ interp_desc->interp = interp; --- 654,672 ---- * to the database AFTER on_*_init code has run. See * http://archives.postgresql.org/pgsql-hackers/2010-01/msg02669.php */ ! { ! dTHX; ! newXS("PostgreSQL::InServer::SPI::bootstrap", ! boot_PostgreSQL__InServer__SPI, __FILE__); ! ! eval_pv("PostgreSQL::InServer::SPI::bootstrap()", FALSE); ! if (SvTRUE(ERRSV)) ! ereport(ERROR, ! (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), ! errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), ! errcontext("while executing PostgreSQL::InServer::SPI::bootstrap"))); ! } /* Fully initialized, so mark the hashtable entry valid */ interp_desc->interp = interp; *************** plperl_init_interp(void) *** 792,844 **** PERL_SET_CONTEXT(plperl); perl_construct(plperl); - /* run END blocks in perl_destruct instead of perl_run */ - PL_exit_flags |= PERL_EXIT_DESTRUCT_END; - /* ! * Record the original function for the 'require' and 'dofile' opcodes. ! * (They share the same implementation.) Ensure it's used for new ! * interpreters. */ - if (!pp_require_orig) - pp_require_orig = PL_ppaddr[OP_REQUIRE]; - else { ! PL_ppaddr[OP_REQUIRE] = pp_require_orig; ! PL_ppaddr[OP_DOFILE] = pp_require_orig; ! } #ifdef PLPERL_ENABLE_OPMASK_EARLY ! /* ! * For regression testing to prove that the PLC_PERLBOOT and PLC_TRUSTED ! * code doesn't even compile any unsafe ops. In future there may be a ! * valid need for them to do so, in which case this could be softened ! * (perhaps moved to plperl_trusted_init()) or removed. ! */ ! PL_op_mask = plperl_opmask; #endif ! if (perl_parse(plperl, plperl_init_shared_libs, ! nargs, embedding, NULL) != 0) ! ereport(ERROR, ! (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), ! errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), ! errcontext("while parsing Perl initialization"))); ! if (perl_run(plperl) != 0) ! ereport(ERROR, ! (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), ! errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), ! errcontext("while running Perl initialization"))); #ifdef PLPERL_RESTORE_LOCALE ! PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate); ! PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype); ! PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary); ! PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric); ! PLPERL_RESTORE_LOCALE(LC_TIME, save_time); #endif return plperl; } --- 809,870 ---- PERL_SET_CONTEXT(plperl); perl_construct(plperl); /* ! * Run END blocks in perl_destruct instead of perl_run. Note that dTHX ! * loads up a pointer to the current interpreter, so we have to postpone ! * it to here rather than put it at the function head. */ { ! dTHX; ! ! PL_exit_flags |= PERL_EXIT_DESTRUCT_END; ! ! /* ! * Record the original function for the 'require' and 'dofile' ! * opcodes. (They share the same implementation.) Ensure it's used ! * for new interpreters. ! */ ! if (!pp_require_orig) ! pp_require_orig = PL_ppaddr[OP_REQUIRE]; ! else ! { ! PL_ppaddr[OP_REQUIRE] = pp_require_orig; ! PL_ppaddr[OP_DOFILE] = pp_require_orig; ! } #ifdef PLPERL_ENABLE_OPMASK_EARLY ! /* ! * For regression testing to prove that the PLC_PERLBOOT and ! * PLC_TRUSTED code doesn't even compile any unsafe ops. In future ! * there may be a valid need for them to do so, in which case this ! * could be softened (perhaps moved to plperl_trusted_init()) or ! * removed. ! */ ! PL_op_mask = plperl_opmask; #endif ! if (perl_parse(plperl, plperl_init_shared_libs, ! nargs, embedding, NULL) != 0) ! ereport(ERROR, ! (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), ! errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), ! errcontext("while parsing Perl initialization"))); ! if (perl_run(plperl) != 0) ! ereport(ERROR, ! (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), ! errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), ! errcontext("while running Perl initialization"))); #ifdef PLPERL_RESTORE_LOCALE ! PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate); ! PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype); ! PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary); ! PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric); ! PLPERL_RESTORE_LOCALE(LC_TIME, save_time); #endif + } return plperl; } *************** plperl_destroy_interp(PerlInterpreter ** *** 904,909 **** --- 930,936 ---- * public API so isn't portably available.) Meanwhile END blocks can * be used to perform manual cleanup. */ + dTHX; /* Run END blocks - based on perl's perl_destruct() */ if (PL_exit_flags & PERL_EXIT_DESTRUCT_END) *************** plperl_destroy_interp(PerlInterpreter ** *** 930,935 **** --- 957,963 ---- static void plperl_trusted_init(void) { + dTHX; HV *stash; SV *sv; char *key; *************** plperl_trusted_init(void) *** 1010,1015 **** --- 1038,1045 ---- static void plperl_untrusted_init(void) { + dTHX; + /* * Nothing to do except execute plperl.on_plperlu_init */ *************** strip_trailing_ws(const char *msg) *** 1045,1050 **** --- 1075,1081 ---- static HeapTuple plperl_build_tuple_result(HV *perlhash, TupleDesc td) { + dTHX; Datum *values; bool *nulls; HE *he; *************** plperl_hash_to_datum(SV *src, TupleDesc *** 1106,1111 **** --- 1137,1144 ---- static SV * get_perl_array_ref(SV *sv) { + dTHX; + if (SvOK(sv) && SvROK(sv)) { if (SvTYPE(SvRV(sv)) == SVt_PVAV) *************** array_to_datum_internal(AV *av, ArrayBui *** 1134,1139 **** --- 1167,1173 ---- Oid arraytypid, Oid elemtypid, int32 typmod, FmgrInfo *finfo, Oid typioparam) { + dTHX; int i; int len = av_len(av) + 1; *************** array_to_datum_internal(AV *av, ArrayBui *** 1205,1210 **** --- 1239,1245 ---- static Datum plperl_array_to_datum(SV *src, Oid typid, int32 typmod) { + dTHX; ArrayBuildState *astate; Oid elemtypid; FmgrInfo finfo; *************** plperl_sv_to_literal(SV *sv, char *fqtyp *** 1407,1412 **** --- 1442,1448 ---- static SV * plperl_ref_from_pg_array(Datum arg, Oid typid) { + dTHX; ArrayType *ar = DatumGetArrayTypeP(arg); Oid elementtype = ARR_ELEMTYPE(ar); int16 typlen; *************** plperl_ref_from_pg_array(Datum arg, Oid *** 1485,1490 **** --- 1521,1527 ---- static SV * split_array(plperl_array_info *info, int first, int last, int nest) { + dTHX; int i; AV *result; *************** split_array(plperl_array_info *info, int *** 1518,1523 **** --- 1555,1561 ---- static SV * make_array_ref(plperl_array_info *info, int first, int last) { + dTHX; int i; AV *result = newAV(); *************** make_array_ref(plperl_array_info *info, *** 1555,1560 **** --- 1593,1599 ---- static SV * plperl_trigger_build_args(FunctionCallInfo fcinfo) { + dTHX; TriggerData *tdata; TupleDesc tupdesc; int i; *************** plperl_trigger_build_args(FunctionCallIn *** 1661,1666 **** --- 1700,1706 ---- static SV * plperl_event_trigger_build_args(FunctionCallInfo fcinfo) { + dTHX; EventTriggerData *tdata; HV *hv; *************** plperl_event_trigger_build_args(Function *** 1678,1683 **** --- 1718,1724 ---- static HeapTuple plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup) { + dTHX; SV **svp; HV *hvNew; HE *he; *************** plperl_inline_handler(PG_FUNCTION_ARGS) *** 1874,1880 **** perlret = plperl_call_perl_func(&desc, &fake_fcinfo); ! SvREFCNT_dec(perlret); if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish() failed"); --- 1915,1921 ---- perlret = plperl_call_perl_func(&desc, &fake_fcinfo); ! SvREFCNT_dec_current(perlret); if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish() failed"); *************** plperl_inline_handler(PG_FUNCTION_ARGS) *** 1882,1888 **** PG_CATCH(); { if (desc.reference) ! SvREFCNT_dec(desc.reference); current_call_data = save_call_data; activate_interpreter(oldinterp); PG_RE_THROW(); --- 1923,1929 ---- PG_CATCH(); { if (desc.reference) ! SvREFCNT_dec_current(desc.reference); current_call_data = save_call_data; activate_interpreter(oldinterp); PG_RE_THROW(); *************** plperl_inline_handler(PG_FUNCTION_ARGS) *** 1890,1896 **** PG_END_TRY(); if (desc.reference) ! SvREFCNT_dec(desc.reference); current_call_data = save_call_data; activate_interpreter(oldinterp); --- 1931,1937 ---- PG_END_TRY(); if (desc.reference) ! SvREFCNT_dec_current(desc.reference); current_call_data = save_call_data; activate_interpreter(oldinterp); *************** plperlu_validator(PG_FUNCTION_ARGS) *** 2018,2023 **** --- 2059,2065 ---- static void plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid) { + dTHX; dSP; char subname[NAMEDATALEN + 40]; HV *pragma_hv = newHV(); *************** plperl_init_shared_libs(pTHX) *** 2104,2109 **** --- 2146,2152 ---- static SV * plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo) { + dTHX; dSP; SV *retval; int i; *************** static SV * *** 2197,2202 **** --- 2240,2246 ---- plperl_call_perl_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo, SV *td) { + dTHX; dSP; SV *retval, *TDsv; *************** plperl_call_perl_event_trigger_func(plpe *** 2265,2270 **** --- 2309,2315 ---- FunctionCallInfo fcinfo, SV *td) { + dTHX; dSP; SV *retval, *TDsv; *************** plperl_func_handler(PG_FUNCTION_ARGS) *** 2384,2396 **** sav = get_perl_array_ref(perlret); if (sav) { int i = 0; SV **svp = 0; AV *rav = (AV *) SvRV(sav); while ((svp = av_fetch(rav, i, FALSE)) != NULL) { ! plperl_return_next(*svp); i++; } } --- 2429,2442 ---- sav = get_perl_array_ref(perlret); if (sav) { + dTHX; int i = 0; SV **svp = 0; AV *rav = (AV *) SvRV(sav); while ((svp = av_fetch(rav, i, FALSE)) != NULL) { ! plperl_return_next_internal(*svp); i++; } } *************** plperl_func_handler(PG_FUNCTION_ARGS) *** 2427,2433 **** /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; ! SvREFCNT_dec(perlret); return retval; } --- 2473,2479 ---- /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; ! SvREFCNT_dec_current(perlret); return retval; } *************** plperl_trigger_handler(PG_FUNCTION_ARGS) *** 2538,2546 **** /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; ! SvREFCNT_dec(svTD); if (perlret) ! SvREFCNT_dec(perlret); return retval; } --- 2584,2592 ---- /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; ! SvREFCNT_dec_current(svTD); if (perlret) ! SvREFCNT_dec_current(perlret); return retval; } *************** plperl_event_trigger_handler(PG_FUNCTION *** 2579,2587 **** /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; ! SvREFCNT_dec(svTD); ! ! return; } --- 2625,2631 ---- /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; ! SvREFCNT_dec_current(svTD); } *************** free_plperl_function(plperl_proc_desc *p *** 2624,2630 **** plperl_interp_desc *oldinterp = plperl_active_interp; activate_interpreter(prodesc->interp); ! SvREFCNT_dec(prodesc->reference); activate_interpreter(oldinterp); } /* Release all PG-owned data for this proc */ --- 2668,2674 ---- plperl_interp_desc *oldinterp = plperl_active_interp; activate_interpreter(prodesc->interp); ! SvREFCNT_dec_current(prodesc->reference); activate_interpreter(oldinterp); } /* Release all PG-owned data for this proc */ *************** plperl_hash_from_datum(Datum attr) *** 2949,2954 **** --- 2993,2999 ---- static SV * plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc) { + dTHX; HV *hv; int i; *************** static HV * *** 3094,3099 **** --- 3139,3145 ---- plperl_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 processed, int status) { + dTHX; HV *result; check_spi_usage_allowed(); *************** plperl_spi_execute_fetch_result(SPITuple *** 3137,3152 **** /* ! * Note: plperl_return_next is called both in Postgres and Perl contexts. ! * We report any errors in Postgres fashion (via ereport). If called in ! * Perl context, it is SPI.xs's responsibility to catch the error and ! * convert to a Perl error. We assume (perhaps without adequate justification) ! * that we need not abort the current transaction if the Perl code traps the ! * error. */ void plperl_return_next(SV *sv) { plperl_proc_desc *prodesc; FunctionCallInfo fcinfo; ReturnSetInfo *rsi; --- 3183,3223 ---- /* ! * plperl_return_next catches any error and converts it to a Perl error. ! * We assume (perhaps without adequate justification) that we need not abort ! * the current transaction if the Perl code traps the error. */ void plperl_return_next(SV *sv) { + MemoryContext oldcontext = CurrentMemoryContext; + + PG_TRY(); + { + plperl_return_next_internal(sv); + } + PG_CATCH(); + { + ErrorData *edata; + + /* Must reset elog.c's state */ + MemoryContextSwitchTo(oldcontext); + edata = CopyErrorData(); + FlushErrorState(); + + /* Punt the error to Perl */ + croak_cstr(edata->message); + } + PG_END_TRY(); + } + + /* + * plperl_return_next_internal reports any errors in Postgres fashion + * (via ereport). + */ + static void + plperl_return_next_internal(SV *sv) + { plperl_proc_desc *prodesc; FunctionCallInfo fcinfo; ReturnSetInfo *rsi; *************** plperl_spi_fetchrow(char *cursor) *** 3336,3341 **** --- 3407,3413 ---- PG_TRY(); { + dTHX; Portal p = SPI_cursor_find(cursor); if (!p) *************** plperl_spi_exec_prepared(char *query, HV *** 3577,3582 **** --- 3649,3656 ---- PG_TRY(); { + dTHX; + /************************************************************ * Fetch the saved plan descriptor, see if it's o.k. ************************************************************/ *************** plperl_spi_freeplan(char *query) *** 3822,3833 **** --- 3896,3949 ---- } /* + * Implementation of plperl's elog() function + * + * If the error level is less than ERROR, we'll just emit the message and + * return. When it is ERROR, elog() will longjmp, which we catch and + * turn into a Perl croak(). Note we are assuming that elog() can't have + * any internal failures that are so bad as to require a transaction abort. + * + * The main reason this is out-of-line is to avoid conflicts between XSUB.h + * and the PG_TRY macros. + */ + void + plperl_util_elog(int level, SV *msg) + { + MemoryContext oldcontext = CurrentMemoryContext; + char *volatile cmsg = NULL; + + PG_TRY(); + { + cmsg = sv2cstr(msg); + elog(level, "%s", cmsg); + pfree(cmsg); + } + PG_CATCH(); + { + ErrorData *edata; + + /* Must reset elog.c's state */ + MemoryContextSwitchTo(oldcontext); + edata = CopyErrorData(); + FlushErrorState(); + + if (cmsg) + pfree(cmsg); + + /* Punt the error to Perl */ + croak_cstr(edata->message); + } + PG_END_TRY(); + } + + /* * Store an SV into a hash table under a key that is a string assumed to be * in the current database's encoding. */ static SV ** hv_store_string(HV *hv, const char *key, SV *val) { + dTHX; int32 hlen; char *hkey; SV **ret; *************** hv_store_string(HV *hv, const char *key, *** 3854,3859 **** --- 3970,3976 ---- static SV ** hv_fetch_string(HV *hv, const char *key) { + dTHX; int32 hlen; char *hkey; SV **ret; diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index eecd192..3f3cce9 100644 *** a/src/pl/plperl/plperl.h --- b/src/pl/plperl/plperl.h *************** *** 44,52 **** --- 44,60 ---- /* required for perl API */ + #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" + + /* + * We want to include this only within .xs files, but it must come before + * ppport.h, so use a #define flag to control inclusion. + */ + #ifdef PG_NEED_PERL_XSUB_H #include "XSUB.h" + #endif /* put back our snprintf and vsnprintf */ #ifdef USE_REPL_SNPRINTF *************** SV *plperl_spi_query_prepared(char * *** 106,110 **** --- 114,119 ---- void plperl_spi_freeplan(char *); void plperl_spi_cursor_close(char *); char *plperl_sv_to_literal(SV *, char *); + void plperl_util_elog(int level, SV *msg); #endif /* PL_PERL_H */ diff --git a/src/pl/plperl/plperl_helpers.h b/src/pl/plperl/plperl_helpers.h index 76124ed..5acac60 100644 *** a/src/pl/plperl/plperl_helpers.h --- b/src/pl/plperl/plperl_helpers.h *************** sv2cstr(SV *sv) *** 54,59 **** --- 54,61 ---- *res; STRLEN len; + dTHX; + /* * get a utf8 encoded char * out of perl. *note* it may not be valid utf8! */ *************** cstr2sv(const char *str) *** 110,115 **** --- 112,119 ---- SV *sv; char *utf8_str; + dTHX; + /* no conversion when SQL_ASCII */ if (GetDatabaseEncoding() == PG_SQL_ASCII) return newSVpv(str, 0); *************** cstr2sv(const char *str) *** 134,139 **** --- 138,145 ---- static inline void croak_cstr(const char *str) { + dTHX; + #ifdef croak_sv /* Use sv_2mortal() to be sure the transient SV gets freed */ croak_sv(sv_2mortal(cstr2sv(str)));
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-28 09:00                                         ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-28 09:00 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Hi,

On Fri, Jul 28, 2017 at 4:20 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> > On 07/27/2017 04:33 PM, Tom Lane wrote:
> >> So I was trying to figure a way to not include XSUB.h except in a very
> >> limited part of plperl, like ideally just the .xs files.  It's looking
> >> like that would take nontrivial refactoring though :-(.  Another problem
> >> is that this critical bit of the library API is in XSUB.h:
>
> > That's the sort of thing that prompted me to ask what was the minimal
> > set of defines required to fix the original problem (assuming such a
> > thing exists)
> > We haven't used PERL_IMPLICIT_CONTEXT to date, and without ill effect.
> > For example. it's in the ExtUtils::Embed::ccopts for the perl that
> > jacana and bowerbird happily build and test against.
>
> Well, actually, PERL_IMPLICIT_CONTEXT is turned on automatically in any
> MULTIPLICITY build, and since it changes all the Perl ABIs, we *are*
> relying on it.  However, after further study of the Perl docs I noticed
> that we could dispense with XSUB.h if we defined PERL_NO_GET_CONTEXT
> (which turns the quoted stanza into a no-op).  That results in needing to
> sprinkle plperl.c with "dTHX" declarations, as explained in perlguts.pod.
> They're slightly tricky to place correctly, because they load up a pointer
> to the current Perl interpreter, so you have to be wary of where to put
> them in functions that change interpreters.  But I seem to have it working
> in the attached patch.  (One benefit of doing this extra work is that it
> should be a bit more efficient, in that we load up a Perl interpreter
> pointer only once per function called, not once per usage therein.  We
> could remove many of those fetches too, if we wanted to sprinkle the
> plperl code with yet more THX droppings; but I left that for another day.)
>
> Armed with that, I got rid of XSUB.h in plperl.c and moved the
> PG_TRY-using functions in the .xs files to plperl.c.  I think this would
> fix Ashutosh's problem, though I am not in a position to try it with a
> PERL_IMPLICIT_SYS build here.

Thanks for the patch. I am seeing some compilation errors on Windows
with the patch. Below are the errors observed,

1>ClCompile:
1>  plperl.c
1>src/pl/plperl/plperl.c(4051): error C2065: 'my_perl' : undeclared identifier

2>ClCompile:
2>  hstore_plperl.c
2>contrib/hstore_plperl/hstore_plperl.c(77): error C2065: 'my_perl' :
undeclared identifier

I did spent some time to find reason for these compilation errors and
could eventually find that some of the Windows specific functions
inside plperl module are calling Perl APIs without fetching the perl
interpreter's context using dTHX. Please note that, we have now
defined PERL_NO_GET_CONTEXT macro before including the Perl headers in
plperl.h file which means any plperl function calling Perl APIs should
try to fetch the perl interpreter context variable 'my_perl' at the
start of the function using dTHX but, we were not doing that for
'setlocale_perl', 'hstore_to_plperl' and 'plperl_to_hstore' functions.
I have corrected this and attached is the new version of patch.

Moreover, I have also tested this patch along with the patch to import
switches used by perl into plperl and together it fixes the server
crash issue. Also, now, the interpreter size in both perl and plperl
module are the same thereby generating the same key on both plperl and
perl module. Thanks.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

avoid-XSUB.h-in-plperl.c-v2.patch (application/octet-stream, 19.2K) download diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/hstore_plperl.c index 480212f..3489ece 100644 --- a/contrib/hstore_plperl/hstore_plperl.c +++ b/contrib/hstore_plperl/hstore_plperl.c @@ -73,6 +73,7 @@ hstore_to_plperl(PG_FUNCTION_ARGS) char *base = STRPTR(in); HEntry *entries = ARRPTR(in); HV *hv; + dTHX; hv = newHV(); @@ -106,6 +107,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS) int32 pcount; HStore *out; Pairs *pairs; + dTHX; hv = (HV *) SvRV((SV *) PG_GETARG_POINTER(0)); diff --git a/src/pl/plperl/SPI.xs b/src/pl/plperl/SPI.xs index 0447c50..7651b62 100644 --- a/src/pl/plperl/SPI.xs +++ b/src/pl/plperl/SPI.xs @@ -15,38 +15,11 @@ #undef _ /* perl stuff */ +#define PG_NEED_PERL_XSUB_H #include "plperl.h" #include "plperl_helpers.h" -/* - * Interface routine to catch ereports and punt them to Perl - */ -static void -do_plperl_return_next(SV *sv) -{ - MemoryContext oldcontext = CurrentMemoryContext; - - PG_TRY(); - { - plperl_return_next(sv); - } - PG_CATCH(); - { - ErrorData *edata; - - /* Must reset elog.c's state */ - MemoryContextSwitchTo(oldcontext); - edata = CopyErrorData(); - FlushErrorState(); - - /* Punt the error to Perl */ - croak_cstr(edata->message); - } - PG_END_TRY(); -} - - MODULE = PostgreSQL::InServer::SPI PREFIX = spi_ PROTOTYPES: ENABLE @@ -76,7 +49,7 @@ void spi_return_next(rv) SV *rv; CODE: - do_plperl_return_next(rv); + plperl_return_next(rv); SV * spi_spi_query(sv) diff --git a/src/pl/plperl/Util.xs b/src/pl/plperl/Util.xs index dbba0d7..862fec4 100644 --- a/src/pl/plperl/Util.xs +++ b/src/pl/plperl/Util.xs @@ -20,48 +20,10 @@ #undef _ /* perl stuff */ +#define PG_NEED_PERL_XSUB_H #include "plperl.h" #include "plperl_helpers.h" -/* - * Implementation of plperl's elog() function - * - * If the error level is less than ERROR, we'll just emit the message and - * return. When it is ERROR, elog() will longjmp, which we catch and - * turn into a Perl croak(). Note we are assuming that elog() can't have - * any internal failures that are so bad as to require a transaction abort. - * - * This is out-of-line to suppress "might be clobbered by longjmp" warnings. - */ -static void -do_util_elog(int level, SV *msg) -{ - MemoryContext oldcontext = CurrentMemoryContext; - char * volatile cmsg = NULL; - - PG_TRY(); - { - cmsg = sv2cstr(msg); - elog(level, "%s", cmsg); - pfree(cmsg); - } - PG_CATCH(); - { - ErrorData *edata; - - /* Must reset elog.c's state */ - MemoryContextSwitchTo(oldcontext); - edata = CopyErrorData(); - FlushErrorState(); - - if (cmsg) - pfree(cmsg); - - /* Punt the error to Perl */ - croak_cstr(edata->message); - } - PG_END_TRY(); -} static text * sv2text(SV *sv) @@ -105,7 +67,7 @@ util_elog(level, msg) level = ERROR; if (level < DEBUG5) level = DEBUG5; - do_util_elog(level, msg); + plperl_util_elog(level, msg); SV * util_quote_literal(sv) diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 5a45e3e..cbac1af 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -285,6 +285,7 @@ static void plperl_init_shared_libs(pTHX); static void plperl_trusted_init(void); static void plperl_untrusted_init(void); static HV *plperl_spi_execute_fetch_result(SPITupleTable *, uint64, int); +static void plperl_return_next_internal(SV *sv); static char *hek2cstr(HE *he); static SV **hv_store_string(HV *hv, const char *key, SV *val); static SV **hv_fetch_string(HV *hv, const char *key); @@ -303,11 +304,23 @@ static char *setlocale_perl(int category, char *locale); #endif /* + * Decrement the refcount of the given SV within the active Perl interpreter + */ +static inline void +SvREFCNT_dec_current(SV *sv) +{ + dTHX; + + SvREFCNT_dec(sv); +} + +/* * convert a HE (hash entry) key to a cstr in the current database encoding */ static char * hek2cstr(HE *he) { + dTHX; char *ret; SV *sv; @@ -641,15 +654,19 @@ select_perl_context(bool trusted) * to the database AFTER on_*_init code has run. See * http://archives.postgresql.org/pgsql-hackers/2010-01/msg02669.php */ - newXS("PostgreSQL::InServer::SPI::bootstrap", - boot_PostgreSQL__InServer__SPI, __FILE__); + { + dTHX; - eval_pv("PostgreSQL::InServer::SPI::bootstrap()", FALSE); - if (SvTRUE(ERRSV)) - ereport(ERROR, - (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), - errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), - errcontext("while executing PostgreSQL::InServer::SPI::bootstrap"))); + newXS("PostgreSQL::InServer::SPI::bootstrap", + boot_PostgreSQL__InServer__SPI, __FILE__); + + eval_pv("PostgreSQL::InServer::SPI::bootstrap()", FALSE); + if (SvTRUE(ERRSV)) + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), + errcontext("while executing PostgreSQL::InServer::SPI::bootstrap"))); + } /* Fully initialized, so mark the hashtable entry valid */ interp_desc->interp = interp; @@ -792,53 +809,62 @@ plperl_init_interp(void) PERL_SET_CONTEXT(plperl); perl_construct(plperl); - /* run END blocks in perl_destruct instead of perl_run */ - PL_exit_flags |= PERL_EXIT_DESTRUCT_END; - /* - * Record the original function for the 'require' and 'dofile' opcodes. - * (They share the same implementation.) Ensure it's used for new - * interpreters. + * Run END blocks in perl_destruct instead of perl_run. Note that dTHX + * loads up a pointer to the current interpreter, so we have to postpone + * it to here rather than put it at the function head. */ - if (!pp_require_orig) - pp_require_orig = PL_ppaddr[OP_REQUIRE]; - else { - PL_ppaddr[OP_REQUIRE] = pp_require_orig; - PL_ppaddr[OP_DOFILE] = pp_require_orig; - } + dTHX; + + PL_exit_flags |= PERL_EXIT_DESTRUCT_END; + + /* + * Record the original function for the 'require' and 'dofile' + * opcodes. (They share the same implementation.) Ensure it's used + * for new interpreters. + */ + if (!pp_require_orig) + pp_require_orig = PL_ppaddr[OP_REQUIRE]; + else + { + PL_ppaddr[OP_REQUIRE] = pp_require_orig; + PL_ppaddr[OP_DOFILE] = pp_require_orig; + } #ifdef PLPERL_ENABLE_OPMASK_EARLY - /* - * For regression testing to prove that the PLC_PERLBOOT and PLC_TRUSTED - * code doesn't even compile any unsafe ops. In future there may be a - * valid need for them to do so, in which case this could be softened - * (perhaps moved to plperl_trusted_init()) or removed. - */ - PL_op_mask = plperl_opmask; + /* + * For regression testing to prove that the PLC_PERLBOOT and + * PLC_TRUSTED code doesn't even compile any unsafe ops. In future + * there may be a valid need for them to do so, in which case this + * could be softened (perhaps moved to plperl_trusted_init()) or + * removed. + */ + PL_op_mask = plperl_opmask; #endif - if (perl_parse(plperl, plperl_init_shared_libs, - nargs, embedding, NULL) != 0) - ereport(ERROR, - (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), - errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), - errcontext("while parsing Perl initialization"))); + if (perl_parse(plperl, plperl_init_shared_libs, + nargs, embedding, NULL) != 0) + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), + errcontext("while parsing Perl initialization"))); - if (perl_run(plperl) != 0) - ereport(ERROR, - (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), - errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), - errcontext("while running Perl initialization"))); + if (perl_run(plperl) != 0) + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), + errcontext("while running Perl initialization"))); #ifdef PLPERL_RESTORE_LOCALE - PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate); - PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype); - PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary); - PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric); - PLPERL_RESTORE_LOCALE(LC_TIME, save_time); + PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate); + PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype); + PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary); + PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric); + PLPERL_RESTORE_LOCALE(LC_TIME, save_time); #endif + } return plperl; } @@ -904,6 +930,7 @@ plperl_destroy_interp(PerlInterpreter **interp) * public API so isn't portably available.) Meanwhile END blocks can * be used to perform manual cleanup. */ + dTHX; /* Run END blocks - based on perl's perl_destruct() */ if (PL_exit_flags & PERL_EXIT_DESTRUCT_END) @@ -930,6 +957,7 @@ plperl_destroy_interp(PerlInterpreter **interp) static void plperl_trusted_init(void) { + dTHX; HV *stash; SV *sv; char *key; @@ -1010,6 +1038,8 @@ plperl_trusted_init(void) static void plperl_untrusted_init(void) { + dTHX; + /* * Nothing to do except execute plperl.on_plperlu_init */ @@ -1045,6 +1075,7 @@ strip_trailing_ws(const char *msg) static HeapTuple plperl_build_tuple_result(HV *perlhash, TupleDesc td) { + dTHX; Datum *values; bool *nulls; HE *he; @@ -1106,6 +1137,8 @@ plperl_hash_to_datum(SV *src, TupleDesc td) static SV * get_perl_array_ref(SV *sv) { + dTHX; + if (SvOK(sv) && SvROK(sv)) { if (SvTYPE(SvRV(sv)) == SVt_PVAV) @@ -1134,6 +1167,7 @@ array_to_datum_internal(AV *av, ArrayBuildState *astate, Oid arraytypid, Oid elemtypid, int32 typmod, FmgrInfo *finfo, Oid typioparam) { + dTHX; int i; int len = av_len(av) + 1; @@ -1205,6 +1239,7 @@ array_to_datum_internal(AV *av, ArrayBuildState *astate, static Datum plperl_array_to_datum(SV *src, Oid typid, int32 typmod) { + dTHX; ArrayBuildState *astate; Oid elemtypid; FmgrInfo finfo; @@ -1407,6 +1442,7 @@ plperl_sv_to_literal(SV *sv, char *fqtypename) static SV * plperl_ref_from_pg_array(Datum arg, Oid typid) { + dTHX; ArrayType *ar = DatumGetArrayTypeP(arg); Oid elementtype = ARR_ELEMTYPE(ar); int16 typlen; @@ -1485,6 +1521,7 @@ plperl_ref_from_pg_array(Datum arg, Oid typid) static SV * split_array(plperl_array_info *info, int first, int last, int nest) { + dTHX; int i; AV *result; @@ -1518,6 +1555,7 @@ split_array(plperl_array_info *info, int first, int last, int nest) static SV * make_array_ref(plperl_array_info *info, int first, int last) { + dTHX; int i; AV *result = newAV(); @@ -1555,6 +1593,7 @@ make_array_ref(plperl_array_info *info, int first, int last) static SV * plperl_trigger_build_args(FunctionCallInfo fcinfo) { + dTHX; TriggerData *tdata; TupleDesc tupdesc; int i; @@ -1661,6 +1700,7 @@ plperl_trigger_build_args(FunctionCallInfo fcinfo) static SV * plperl_event_trigger_build_args(FunctionCallInfo fcinfo) { + dTHX; EventTriggerData *tdata; HV *hv; @@ -1678,6 +1718,7 @@ plperl_event_trigger_build_args(FunctionCallInfo fcinfo) static HeapTuple plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup) { + dTHX; SV **svp; HV *hvNew; HE *he; @@ -1874,7 +1915,7 @@ plperl_inline_handler(PG_FUNCTION_ARGS) perlret = plperl_call_perl_func(&desc, &fake_fcinfo); - SvREFCNT_dec(perlret); + SvREFCNT_dec_current(perlret); if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish() failed"); @@ -1882,7 +1923,7 @@ plperl_inline_handler(PG_FUNCTION_ARGS) PG_CATCH(); { if (desc.reference) - SvREFCNT_dec(desc.reference); + SvREFCNT_dec_current(desc.reference); current_call_data = save_call_data; activate_interpreter(oldinterp); PG_RE_THROW(); @@ -1890,7 +1931,7 @@ plperl_inline_handler(PG_FUNCTION_ARGS) PG_END_TRY(); if (desc.reference) - SvREFCNT_dec(desc.reference); + SvREFCNT_dec_current(desc.reference); current_call_data = save_call_data; activate_interpreter(oldinterp); @@ -2018,6 +2059,7 @@ plperlu_validator(PG_FUNCTION_ARGS) static void plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid) { + dTHX; dSP; char subname[NAMEDATALEN + 40]; HV *pragma_hv = newHV(); @@ -2104,6 +2146,7 @@ plperl_init_shared_libs(pTHX) static SV * plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo) { + dTHX; dSP; SV *retval; int i; @@ -2197,6 +2240,7 @@ static SV * plperl_call_perl_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo, SV *td) { + dTHX; dSP; SV *retval, *TDsv; @@ -2265,6 +2309,7 @@ plperl_call_perl_event_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo, SV *td) { + dTHX; dSP; SV *retval, *TDsv; @@ -2384,13 +2429,14 @@ plperl_func_handler(PG_FUNCTION_ARGS) sav = get_perl_array_ref(perlret); if (sav) { + dTHX; int i = 0; SV **svp = 0; AV *rav = (AV *) SvRV(sav); while ((svp = av_fetch(rav, i, FALSE)) != NULL) { - plperl_return_next(*svp); + plperl_return_next_internal(*svp); i++; } } @@ -2427,7 +2473,7 @@ plperl_func_handler(PG_FUNCTION_ARGS) /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; - SvREFCNT_dec(perlret); + SvREFCNT_dec_current(perlret); return retval; } @@ -2538,9 +2584,9 @@ plperl_trigger_handler(PG_FUNCTION_ARGS) /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; - SvREFCNT_dec(svTD); + SvREFCNT_dec_current(svTD); if (perlret) - SvREFCNT_dec(perlret); + SvREFCNT_dec_current(perlret); return retval; } @@ -2579,9 +2625,7 @@ plperl_event_trigger_handler(PG_FUNCTION_ARGS) /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; - SvREFCNT_dec(svTD); - - return; + SvREFCNT_dec_current(svTD); } @@ -2624,7 +2668,7 @@ free_plperl_function(plperl_proc_desc *prodesc) plperl_interp_desc *oldinterp = plperl_active_interp; activate_interpreter(prodesc->interp); - SvREFCNT_dec(prodesc->reference); + SvREFCNT_dec_current(prodesc->reference); activate_interpreter(oldinterp); } /* Release all PG-owned data for this proc */ @@ -2949,6 +2993,7 @@ plperl_hash_from_datum(Datum attr) static SV * plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc) { + dTHX; HV *hv; int i; @@ -3094,6 +3139,7 @@ static HV * plperl_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 processed, int status) { + dTHX; HV *result; check_spi_usage_allowed(); @@ -3137,16 +3183,41 @@ plperl_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 processed, /* - * Note: plperl_return_next is called both in Postgres and Perl contexts. - * We report any errors in Postgres fashion (via ereport). If called in - * Perl context, it is SPI.xs's responsibility to catch the error and - * convert to a Perl error. We assume (perhaps without adequate justification) - * that we need not abort the current transaction if the Perl code traps the - * error. + * plperl_return_next catches any error and converts it to a Perl error. + * We assume (perhaps without adequate justification) that we need not abort + * the current transaction if the Perl code traps the error. */ void plperl_return_next(SV *sv) { + MemoryContext oldcontext = CurrentMemoryContext; + + PG_TRY(); + { + plperl_return_next_internal(sv); + } + PG_CATCH(); + { + ErrorData *edata; + + /* Must reset elog.c's state */ + MemoryContextSwitchTo(oldcontext); + edata = CopyErrorData(); + FlushErrorState(); + + /* Punt the error to Perl */ + croak_cstr(edata->message); + } + PG_END_TRY(); +} + +/* + * plperl_return_next_internal reports any errors in Postgres fashion + * (via ereport). + */ +static void +plperl_return_next_internal(SV *sv) +{ plperl_proc_desc *prodesc; FunctionCallInfo fcinfo; ReturnSetInfo *rsi; @@ -3336,6 +3407,7 @@ plperl_spi_fetchrow(char *cursor) PG_TRY(); { + dTHX; Portal p = SPI_cursor_find(cursor); if (!p) @@ -3577,6 +3649,8 @@ plperl_spi_exec_prepared(char *query, HV *attr, int argc, SV **argv) PG_TRY(); { + dTHX; + /************************************************************ * Fetch the saved plan descriptor, see if it's o.k. ************************************************************/ @@ -3822,12 +3896,54 @@ plperl_spi_freeplan(char *query) } /* + * Implementation of plperl's elog() function + * + * If the error level is less than ERROR, we'll just emit the message and + * return. When it is ERROR, elog() will longjmp, which we catch and + * turn into a Perl croak(). Note we are assuming that elog() can't have + * any internal failures that are so bad as to require a transaction abort. + * + * The main reason this is out-of-line is to avoid conflicts between XSUB.h + * and the PG_TRY macros. + */ +void +plperl_util_elog(int level, SV *msg) +{ + MemoryContext oldcontext = CurrentMemoryContext; + char *volatile cmsg = NULL; + + PG_TRY(); + { + cmsg = sv2cstr(msg); + elog(level, "%s", cmsg); + pfree(cmsg); + } + PG_CATCH(); + { + ErrorData *edata; + + /* Must reset elog.c's state */ + MemoryContextSwitchTo(oldcontext); + edata = CopyErrorData(); + FlushErrorState(); + + if (cmsg) + pfree(cmsg); + + /* Punt the error to Perl */ + croak_cstr(edata->message); + } + PG_END_TRY(); +} + +/* * Store an SV into a hash table under a key that is a string assumed to be * in the current database's encoding. */ static SV ** hv_store_string(HV *hv, const char *key, SV *val) { + dTHX; int32 hlen; char *hkey; SV **ret; @@ -3854,6 +3970,7 @@ hv_store_string(HV *hv, const char *key, SV *val) static SV ** hv_fetch_string(HV *hv, const char *key) { + dTHX; int32 hlen; char *hkey; SV **ret; @@ -3913,6 +4030,7 @@ static char * setlocale_perl(int category, char *locale) { char *RETVAL = setlocale(category, locale); + dTHX; if (RETVAL) { diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index eecd192..3f3cce9 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -44,9 +44,17 @@ /* required for perl API */ +#define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" + +/* + * We want to include this only within .xs files, but it must come before + * ppport.h, so use a #define flag to control inclusion. + */ +#ifdef PG_NEED_PERL_XSUB_H #include "XSUB.h" +#endif /* put back our snprintf and vsnprintf */ #ifdef USE_REPL_SNPRINTF @@ -106,5 +114,6 @@ SV *plperl_spi_query_prepared(char *, int, SV **); void plperl_spi_freeplan(char *); void plperl_spi_cursor_close(char *); char *plperl_sv_to_literal(SV *, char *); +void plperl_util_elog(int level, SV *msg); #endif /* PL_PERL_H */ diff --git a/src/pl/plperl/plperl_helpers.h b/src/pl/plperl/plperl_helpers.h index 76124ed..5acac60 100644 --- a/src/pl/plperl/plperl_helpers.h +++ b/src/pl/plperl/plperl_helpers.h @@ -54,6 +54,8 @@ sv2cstr(SV *sv) *res; STRLEN len; + dTHX; + /* * get a utf8 encoded char * out of perl. *note* it may not be valid utf8! */ @@ -110,6 +112,8 @@ cstr2sv(const char *str) SV *sv; char *utf8_str; + dTHX; + /* no conversion when SQL_ASCII */ if (GetDatabaseEncoding() == PG_SQL_ASCII) return newSVpv(str, 0); @@ -134,6 +138,8 @@ cstr2sv(const char *str) static inline void croak_cstr(const char *str) { + dTHX; + #ifdef croak_sv /* Use sv_2mortal() to be sure the transient SV gets freed */ croak_sv(sv_2mortal(cstr2sv(str)));
plperl_win_v2.patch (application/octet-stream, 895B) download From 518bdc92b619b4d1c906431854e9728ddc955474 Mon Sep 17 00:00:00 2001 From: Ashutosh <ashu.coek@gmail.com> Date: Thu, 27 Jul 2017 18:24:19 +0530 Subject: [PATCH] Windows fix --- src/tools/msvc/Mkvcbuild.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index e0bf607..f1a991b 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -518,6 +518,16 @@ sub mkvcbuild $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl'); $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE'); $plperl->AddDefine('PLPERL_HAVE_UID_GID'); + + foreach my $f (split(" ",$Config{ccflags})) + { + if ($f =~ /^-D/) + { + $f =~ s/\-D//; + $plperl->AddDefine($f); + } + } + foreach my $xs ('SPI.xs', 'Util.xs') { (my $xsc = $xs) =~ s/\.xs/.c/; -- 2.10.2.windows.1
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-28 13:52                                           ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 16:16                                             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-28 13:52 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> Thanks for the patch. I am seeing some compilation errors on Windows
> with the patch. Below are the errors observed,
> ...
> I did spent some time to find reason for these compilation errors and
> could eventually find that some of the Windows specific functions
> inside plperl module are calling Perl APIs without fetching the perl
> interpreter's context using dTHX.

Ah, thanks.  I just stuck that in where compiler errors were telling
me to, so I didn't realize there were Windows-specific functions to
worry about.

> Moreover, I have also tested this patch along with the patch to import
> switches used by perl into plperl and together it fixes the server
> crash issue. Also, now, the interpreter size in both perl and plperl
> module are the same thereby generating the same key on both plperl and
> perl module. Thanks.

Excellent.  So this looks like the avenue to pursue.

As far as the question of which symbols to import goes: on my own
machines I'm seeing a lot of things like

$ perl -MConfig -e 'print $Config{ccflags}'
-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

$ perl -MConfig -e 'print $Config{ccflags}'
 -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 

I'm really quite afraid to import symbols like _LARGEFILE_SOURCE and
_FILE_OFFSET_BITS into plperl; those *will* break things if they
are different from what core Postgres is built with.  Moreover,
I came across a relevant data structure in perl.h:

/* These are all the compile time options that affect binary compatibility.
   Other compile time options that are binary compatible are in perl.c
   Both are combined for the output of perl -V
   However, this string will be embedded in any shared perl library, which will
   allow us add a comparison check in perlmain.c in the near future.  */
#ifdef DOINIT
EXTCONST char PL_bincompat_options[] =
#  ifdef DEBUG_LEAKING_SCALARS
			     " DEBUG_LEAKING_SCALARS"
#  endif
#  ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
			     " DEBUG_LEAKING_SCALARS_FORK_DUMP"
#  endif
#  ifdef FAKE_THREADS
			     " FAKE_THREADS"
#  endif
#  ifdef MULTIPLICITY
			     " MULTIPLICITY"
#  endif
... lots more ...

Assuming that the Perl crew know what they're doing and this list is
complete, I notice that not one of the symbols they show as relevant
starts with an underscore.  So I'm thinking that my previous semi-
joking idea of absorbing only -D switches for names that *don't*
start with an underscore was actually a good solution.  If that
turns out to not be enough of a filter, we could consider looking
into perl.h to extract the set of symbols tested in building
PL_bincompat_options and then intersecting that with what we get
from Perl's ccflags.  But that would be a lot more complex, so
I'd rather go with the simpler filter rule for now.

(BTW, you never did tell us exactly what defines you're getting
out of Perl's flags on the problem installation.)

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-28 16:16                                             ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 16:35                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-28 16:16 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Fri, Jul 28, 2017 at 7:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> Thanks for the patch. I am seeing some compilation errors on Windows
>> with the patch. Below are the errors observed,
>> ...
>> I did spent some time to find reason for these compilation errors and
>> could eventually find that some of the Windows specific functions
>> inside plperl module are calling Perl APIs without fetching the perl
>> interpreter's context using dTHX.
>
> Ah, thanks.  I just stuck that in where compiler errors were telling
> me to, so I didn't realize there were Windows-specific functions to
> worry about.
>
>> Moreover, I have also tested this patch along with the patch to import
>> switches used by perl into plperl and together it fixes the server
>> crash issue. Also, now, the interpreter size in both perl and plperl
>> module are the same thereby generating the same key on both plperl and
>> perl module. Thanks.
>
> Excellent.  So this looks like the avenue to pursue.
>
> As far as the question of which symbols to import goes: on my own
> machines I'm seeing a lot of things like
>
> $ perl -MConfig -e 'print $Config{ccflags}'
> -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
>
> $ perl -MConfig -e 'print $Config{ccflags}'
>  -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
>
> I'm really quite afraid to import symbols like _LARGEFILE_SOURCE and
> _FILE_OFFSET_BITS into plperl; those *will* break things if they
> are different from what core Postgres is built with.  Moreover,
> I came across a relevant data structure in perl.h:
>
> /* These are all the compile time options that affect binary compatibility.
>    Other compile time options that are binary compatible are in perl.c
>    Both are combined for the output of perl -V
>    However, this string will be embedded in any shared perl library, which will
>    allow us add a comparison check in perlmain.c in the near future.  */
> #ifdef DOINIT
> EXTCONST char PL_bincompat_options[] =
> #  ifdef DEBUG_LEAKING_SCALARS
>                              " DEBUG_LEAKING_SCALARS"
> #  endif
> #  ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
>                              " DEBUG_LEAKING_SCALARS_FORK_DUMP"
> #  endif
> #  ifdef FAKE_THREADS
>                              " FAKE_THREADS"
> #  endif
> #  ifdef MULTIPLICITY
>                              " MULTIPLICITY"
> #  endif
> ... lots more ...

Thanks for sharing this information. I too had a look into
'PL_bincompat_options' data structure in perl.h and i didn't see any
macro name starting with underscore. Based on this information, we can
now confidently say that we do not need any -D switches starting with
underscore for binary compatibility purpose.

>
> Assuming that the Perl crew know what they're doing and this list is
> complete, I notice that not one of the symbols they show as relevant
> starts with an underscore.  So I'm thinking that my previous semi-
> joking idea of absorbing only -D switches for names that *don't*
> start with an underscore was actually a good solution.

Yes, it was a good solution indeed.

If that
> turns out to not be enough of a filter, we could consider looking
> into perl.h to extract the set of symbols tested in building
> PL_bincompat_options and then intersecting that with what we get
> from Perl's ccflags.  But that would be a lot more complex, so
> I'd rather go with the simpler filter rule for now.

Okay, as per your suggestion, I have modified my earlier patches that
imports the -D switches used by perl into plperl accordingly i.e. it
now ignores the switches whose name starts with underscore. Please
find plperl_win_v3 and plperl_linux_v2 patches attached with this
email.

>
> (BTW, you never did tell us exactly what defines you're getting
> out of Perl's flags on the problem installation.)

I am really sorry about that. I just missed that in my earlier email.
Here are the defines used in the perl where i could reproduce the
issue,

C:\Users\ashu>perl -MConfig -e "print $Config{ccflags}"
-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32
-D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE  -DUSE_SITECUSTOMIZE
-DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

plperl_win_v3.patch (text/x-patch, 629B) download diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index e0bf607..f0ada1b 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -518,6 +518,16 @@ sub mkvcbuild $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl'); $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE'); $plperl->AddDefine('PLPERL_HAVE_UID_GID'); + + foreach my $f (split(" ",$Config{ccflags})) + { + if ($f =~ /^-D/ && $f !~ /^-D_/) + { + $f =~ s/\-D//; + $plperl->AddDefine($f); + } + } + foreach my $xs ('SPI.xs', 'Util.xs') { (my $xsc = $xs) =~ s/\.xs/.c/;
plperl_linux_v2.patch (text/x-patch, 2.9K) download diff --git a/config/perl.m4 b/config/perl.m4 index bed2eae..d4ec25f 100644 --- a/config/perl.m4 +++ b/config/perl.m4 @@ -49,6 +49,16 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS], [m4_foreach([pgac_item], [$1], [PGAC_CHECK_PERL_CONFIG(pgac_item)])]) +# PGAC_CHECK_PERL_EMBED_CCFLAGS +# ----------------------------- +AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS], +[AC_REQUIRE([PGAC_PATH_PERL]) +AC_MSG_CHECKING([for CFLAGS to compile embedded Perl]) +perl_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {if ($f =~ /^-D/ && $f !~ /^-D_/) {print $f, " "}}'` +AC_SUBST(perl_ccflags)dnl +AC_MSG_RESULT([$perl_ccflags])]) + + # PGAC_CHECK_PERL_EMBED_LDFLAGS # ----------------------------- # We are after Embed's ldopts, but without the subset mentioned in diff --git a/configure b/configure index aff72eb..ddff4ef 100755 --- a/configure +++ b/configure @@ -667,6 +667,7 @@ python_includespec python_version python_majorversion PYTHON +perl_ccflags perl_embed_ldflags perl_useshrplib perl_privlibexp @@ -7767,6 +7768,18 @@ documentation for details. Use --without-perl to disable building PL/Perl." "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl ccflags" >&5 +$as_echo_n "checking for Perl ccflags... " >&6; } +perl_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {if ($f =~ /^-D/ && $f !~ /^-D_/) {print $f, " "}}'` + +if test -z "$perl_ccflags" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_ccflags" >&5 +$as_echo "$perl_ccflags" >&6; } +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flags to link embedded Perl" >&5 $as_echo_n "checking for flags to link embedded Perl... " >&6; } if test "$PORTNAME" = "win32" ; then diff --git a/configure.in b/configure.in index 72e5b17..13c69d6 100644 --- a/configure.in +++ b/configure.in @@ -938,6 +938,7 @@ You might have to rebuild your Perl installation. Refer to the documentation for details. Use --without-perl to disable building PL/Perl.]) fi + PGAC_CHECK_PERL_EMBED_CCFLAGS PGAC_CHECK_PERL_EMBED_LDFLAGS fi diff --git a/src/Makefile.global.in b/src/Makefile.global.in index dc8a89a..ff1c185 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -304,6 +304,7 @@ else endif perl_archlibexp = @perl_archlibexp@ perl_privlibexp = @perl_privlibexp@ +perl_ccflags = @perl_ccflags@ perl_embed_ldflags = @perl_embed_ldflags@ # Miscellaneous diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile index b8e3585..dce0513 100644 --- a/src/pl/plperl/GNUmakefile +++ b/src/pl/plperl/GNUmakefile @@ -12,7 +12,7 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID override CPPFLAGS += -Wno-comment endif -override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE +override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE $(perl_ccflags) rpathdir = $(perl_archlibexp)/CORE
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 16:16                                             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-28 16:35                                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 17:04                                                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-28 16:35 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> On Fri, Jul 28, 2017 at 7:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Assuming that the Perl crew know what they're doing and this list is
>> complete, I notice that not one of the symbols they show as relevant
>> starts with an underscore.  So I'm thinking that my previous semi-
>> joking idea of absorbing only -D switches for names that *don't*
>> start with an underscore was actually a good solution.

> Okay, as per your suggestion, I have modified my earlier patches that
> imports the -D switches used by perl into plperl accordingly i.e. it
> now ignores the switches whose name starts with underscore. Please
> find plperl_win_v3 and plperl_linux_v2 patches attached with this
> email.

OK, thanks.  I've pushed the XSUB/dTHX patch after another round of
code-reading and some minor comment improvements; we'll soon see
what the buildfarm thinks of it.  In the meantime I'll work on these
two patches.

>> (BTW, you never did tell us exactly what defines you're getting
>> out of Perl's flags on the problem installation.)

> I am really sorry about that. I just missed that in my earlier email.
> Here are the defines used in the perl where i could reproduce the
> issue,

> C:\Users\ashu>perl -MConfig -e "print $Config{ccflags}"
> -nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32
> -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE  -DUSE_SITECUSTOMIZE
> -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS

Uh-huh.  So the issue is indeed that they're injecting PERL_IMPLICIT_SYS
via a command-line #define rather than putting it into perl's config.h,
and that results in a change in the apparent size of the PerlInterp
struct (because of IMem and friends).  We'd expected as much, but it's
good to have clear confirmation.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 16:16                                             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 16:35                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-28 17:04                                                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 18:35                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-28 17:04 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Fri, Jul 28, 2017 at 10:05 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> On Fri, Jul 28, 2017 at 7:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Assuming that the Perl crew know what they're doing and this list is
>>> complete, I notice that not one of the symbols they show as relevant
>>> starts with an underscore.  So I'm thinking that my previous semi-
>>> joking idea of absorbing only -D switches for names that *don't*
>>> start with an underscore was actually a good solution.
>
>> Okay, as per your suggestion, I have modified my earlier patches that
>> imports the -D switches used by perl into plperl accordingly i.e. it
>> now ignores the switches whose name starts with underscore. Please
>> find plperl_win_v3 and plperl_linux_v2 patches attached with this
>> email.
>
> OK, thanks.  I've pushed the XSUB/dTHX patch after another round of
> code-reading and some minor comment improvements; we'll soon see
> what the buildfarm thinks of it.  In the meantime I'll work on these
> two patches.

Sure, Thanks a lot.

>
>>> (BTW, you never did tell us exactly what defines you're getting
>>> out of Perl's flags on the problem installation.)
>
>> I am really sorry about that. I just missed that in my earlier email.
>> Here are the defines used in the perl where i could reproduce the
>> issue,
>
>> C:\Users\ashu>perl -MConfig -e "print $Config{ccflags}"
>> -nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32
>> -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE  -DUSE_SITECUSTOMIZE
>> -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
>
> Uh-huh.  So the issue is indeed that they're injecting PERL_IMPLICIT_SYS
> via a command-line #define rather than putting it into perl's config.h,
> and that results in a change in the apparent size of the PerlInterp
> struct (because of IMem and friends).

Yes, That's right. We would have seen different result if the
PERL_IMPLICIT_SYS would not have been defined globally.

We'd expected as much, but it's
> good to have clear confirmation.

That's right. It is always good to have a clear confirmation. Thanks.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 16:16                                             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 16:35                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 17:04                                                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-28 18:35                                                   ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 19:47                                                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-28 18:35 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Magnus Hagander <magnus@hagander.net>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> On Fri, Jul 28, 2017 at 10:05 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Uh-huh.  So the issue is indeed that they're injecting PERL_IMPLICIT_SYS
>> via a command-line #define rather than putting it into perl's config.h,
>> and that results in a change in the apparent size of the PerlInterp
>> struct (because of IMem and friends).

> Yes, That's right. We would have seen different result if the
> PERL_IMPLICIT_SYS would not have been defined globally.

I've pushed the changes to the build scripts now.  I had to revise the
Mkvcbuild.pm part a bit, because you'd forgotten to propagate the extra
defines into hstore_plperl.  So that code is untested; please confirm
that HEAD works in your problem environment now.

I notice that Mkvcbuild.pm is artificially injecting a define for
PLPERL_HAVE_UID_GID.  I strongly suspect that that was a hack meant
to work around the lack of this mechanism, and that we could now
get rid of it or clean it up.  But there's no evidence in the commit
log about the reason for it --- it seems to go back to the original
addition of MSVC support.  Anybody remember?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 16:16                                             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 16:35                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 17:04                                                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 18:35                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-28 19:47                                                     ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 21:15                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-28 19:47 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Magnus Hagander <magnus@hagander.net>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Sat, Jul 29, 2017 at 12:05 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> On Fri, Jul 28, 2017 at 10:05 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Uh-huh.  So the issue is indeed that they're injecting PERL_IMPLICIT_SYS
>>> via a command-line #define rather than putting it into perl's config.h,
>>> and that results in a change in the apparent size of the PerlInterp
>>> struct (because of IMem and friends).
>
>> Yes, That's right. We would have seen different result if the
>> PERL_IMPLICIT_SYS would not have been defined globally.
>
> I've pushed the changes to the build scripts now.  I had to revise the
> Mkvcbuild.pm part a bit, because you'd forgotten to propagate the extra
> defines into hstore_plperl.

Thanks for that.

So that code is untested; please confirm
> that HEAD works in your problem environment now.
>

I quickly ran the some basic test-cases on my Windows machine (machine
where i have been regenerating the issue) and they are all passing.
Also, all the automated test-cases for contrib module hstore_plperl
are passing.

> I notice that Mkvcbuild.pm is artificially injecting a define for
> PLPERL_HAVE_UID_GID.  I strongly suspect that that was a hack meant
> to work around the lack of this mechanism, and that we could now
> get rid of it or clean it up.  But there's no evidence in the commit
> log about the reason for it --- it seems to go back to the original
> addition of MSVC support.  Anybody remember?
>
>                         regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 14:36           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-13 16:14             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 17:00               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 15:48                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 16:12                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-19 17:44                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-19 21:01                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-25 14:23                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:08                           ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-26 03:21                             ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-26 14:26                               ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-27 14:21                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 20:14                                   ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-07-27 20:33                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-27 22:50                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 09:00                                         ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 13:52                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 16:16                                             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 16:35                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 17:04                                                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-28 18:35                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-28 19:47                                                     ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-28 21:15                                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-28 21:15 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Magnus Hagander <magnus@hagander.net>; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Dave Page <dpage@pgadmin.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> I quickly ran the some basic test-cases on my Windows machine (machine
> where i have been regenerating the issue) and they are all passing.
> Also, all the automated test-cases for contrib module hstore_plperl
> are passing.

Cool, thanks.  I hope people will set up some buildfarm machines with
the formerly-broken configurations.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-12 18:31     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-07-13 12:08       ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-13 12:34         ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-07-14 06:35           ` Ashutosh Sharma <ashu.coek88@gmail.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-14 06:35 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Dave Page <dpage@pgadmin.org>; Tom Lane <tgl@sss.pgh.pa.us>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; pgsql-hackers

On Thu, Jul 13, 2017 at 6:04 PM, Andrew Dunstan
<andrew.dunstan@2ndquadrant.com> wrote:
>
>
> On 07/13/2017 08:08 AM, Ashutosh Sharma wrote:
>>
>> After doing some study, I could understand that Util.c is generated
>> from Util.xs by xsubpp compiler at build time. This is being done in
>> Mkvcbuild.pm file in postgres. If I manually replace
>> 'dXSBOOTARGSAPIVERCHK' macro with 'dXSBOOTARGSNOVERCHK' macro in
>> src/pl/plperl/Util.c, the things work fine. The diff is as follows,
>>
>> XS_EXTERNAL(boot_PostgreSQL__InServer__Util)
>> {
>> #if PERL_VERSION_LE(5, 21, 5)
>>     dVAR; dXSARGS;
>> #else
>> -    dVAR; dXSBOOTARGSAPIVERCHK;
>> +    dVAR; dXSBOOTARGSNOVERCHK;
>>
>> I need to further investigate, but let me know if you have any ideas.
>
>
>
>
> Good job hunting this down!
>
>
> One suggestion I saw in a little googling was that we add this to the XS
> file after the inclusion of XSUB.h:
>
>     #undef dXSBOOTARGSAPIVERCHK
>     #define dXSBOOTARGSAPIVERCHK dXSBOOTARGSNOVERCHK
>

Thanks for that suggestion. It was really helpful. I think, the point
is, in XSUB.h, the macro 'dXSBOOTARGSXSAPIVERCHK' has been redefined
for novercheck but surprisingly it hasn't been done for
'dXSBOOTARGSAPIVERCHK' macro and that could be the reason why we want
to redefine it in the XS file after including XSUB.h file. Attached is
the patch that redefines 'dXSBOOTARGSAPIVERCHK' in Util.xs and SPI.xs
files. Please have a look into the attached patch and let me know your
comments. Thanks.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

redefine_dXSBOOTARGSAPIVERCHK_macro.patch (application/octet-stream, 709B) download diff --git a/src/pl/plperl/SPI.xs b/src/pl/plperl/SPI.xs index 0447c50..1175426 100644 --- a/src/pl/plperl/SPI.xs +++ b/src/pl/plperl/SPI.xs @@ -18,6 +18,8 @@ #include "plperl.h" #include "plperl_helpers.h" +#undef dXSBOOTARGSAPIVERCHK +#define dXSBOOTARGSAPIVERCHK dXSBOOTARGSNOVERCHK /* * Interface routine to catch ereports and punt them to Perl diff --git a/src/pl/plperl/Util.xs b/src/pl/plperl/Util.xs index dbba0d7..d642aa5 100644 --- a/src/pl/plperl/Util.xs +++ b/src/pl/plperl/Util.xs @@ -23,6 +23,9 @@ #include "plperl.h" #include "plperl_helpers.h" +#undef dXSBOOTARGSAPIVERCHK +#define dXSBOOTARGSAPIVERCHK dXSBOOTARGSNOVERCHK + /* * Implementation of plperl's elog() function *
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
@ 2017-07-13 19:53     ` Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Christoph Berg @ 2017-07-13 19:53 UTC (permalink / raw)
  To: pgsql-hackers

Re: Dave Page 2017-07-12 <CA+OCxox=h5xftcnyk1AfA_QKSQSruD=Er0qweZakiCEg3U4rcg@mail.gmail.com>
> > Well, we have various buildfarm machines running perls newer than that,
> > eg, crake, with 5.24.1.  So I'd say there is something busted about your
> > perl installation.  Perhaps leftover bits of an older version somewhere?
> >
> 
> Well crake is a Fedora box - and we have no problems on Linux, only on
> Windows.

The plperl segfault on Debian's kfreebsd port I reported back in 2013
is also still present:

https://www.postgresql.org/message-id/20130515064201.GC704%40msgid.df7cb.de

https://buildd.debian.org/status/fetch.php?pkg=postgresql-10&arch=kfreebsd-amd64&ver=10~beta...

(Arguably, this is a toy architecture, so we can just leave it unfixed
there without any harm...)

Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
@ 2017-07-28 21:14       ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-28 21:14 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; +Cc: pgsql-hackers

Christoph Berg <myon@debian.org> writes:
> The plperl segfault on Debian's kfreebsd port I reported back in 2013
> is also still present:
> https://www.postgresql.org/message-id/20130515064201.GC704%40msgid.df7cb.de
> https://buildd.debian.org/status/fetch.php?pkg=postgresql-10&arch=kfreebsd-amd64&ver=10~beta...

So it'd be interesting to know if it's any better with HEAD ...

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-30 21:14         ` Christoph Berg <myon@debian.org>
  2017-07-30 21:30           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Christoph Berg @ 2017-07-30 21:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-hackers

Re: Tom Lane 2017-07-28 <3254.1501276475@sss.pgh.pa.us>
> Christoph Berg <myon@debian.org> writes:
> > The plperl segfault on Debian's kfreebsd port I reported back in 2013
> > is also still present:
> > https://www.postgresql.org/message-id/20130515064201.GC704%40msgid.df7cb.de
> > https://buildd.debian.org/status/fetch.php?pkg=postgresql-10&arch=kfreebsd-amd64&ver=10~beta...
> 
> So it'd be interesting to know if it's any better with HEAD ...

Unfortunately not:

============== creating database "pl_regression"      ==============
CREATE DATABASE
ALTER DATABASE
============== installing plperl                      ==============
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
connection to server was lost

The only interesting line in log/postmaster.log is a log_line_prefix-less
Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
... which is unchanged from the beta2 output.

Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
@ 2017-07-30 21:30           ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-07-30 21:30 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; +Cc: pgsql-hackers

Christoph Berg <myon@debian.org> writes:
> Re: Tom Lane 2017-07-28 <3254.1501276475@sss.pgh.pa.us>
>> Christoph Berg <myon@debian.org> writes:
>>> The plperl segfault on Debian's kfreebsd port I reported back in 2013
>>> is also still present:

>> So it'd be interesting to know if it's any better with HEAD ...

> Unfortunately not:
> The only interesting line in log/postmaster.log is a log_line_prefix-less
> Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
> ... which is unchanged from the beta2 output.

Well, that's quite interesting, because it implies that this is indeed
the same type of problem.  I wonder why the patch didn't fix it?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
@ 2017-07-31 03:48           ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 06:11             ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  1 sibling, 2 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-31 03:48 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers

Hi Christoph,

On Mon, Jul 31, 2017 at 2:44 AM, Christoph Berg <myon@debian.org> wrote:
> Re: Tom Lane 2017-07-28 <3254.1501276475@sss.pgh.pa.us>
>> Christoph Berg <myon@debian.org> writes:
>> > The plperl segfault on Debian's kfreebsd port I reported back in 2013
>> > is also still present:
>> > https://www.postgresql.org/message-id/20130515064201.GC704%40msgid.df7cb.de
>> > https://buildd.debian.org/status/fetch.php?pkg=postgresql-10&arch=kfreebsd-amd64&ver=10~beta...
>>
>> So it'd be interesting to know if it's any better with HEAD ...
>
> Unfortunately not:
>
> ============== creating database "pl_regression"      ==============
> CREATE DATABASE
> ALTER DATABASE
> ============== installing plperl                      ==============
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> connection to server was lost
>
> The only interesting line in log/postmaster.log is a log_line_prefix-less
> Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
> ... which is unchanged from the beta2 output.


I am not able to reproduce this issue on my Windows or Linux box. Have
you deleted Util.c and SPI.c files before starting with the build? The
point is, these files are generated during build time and if they
already exist then i think. they are not re generated. I would suggest
to delete both the .c files and rebuild your source and then give a
try.

Here are the results i got on Windows and Linux respectively on HEAD,

On Windows:

C:\Users\ashu\git-clone-postgresql\postgresql\src\tools\msvc>vcregress.bat
PLCHECK
============================================================
Checking plperl
(using postmaster on localhost, default port)
============== dropping database "pl_regression"      ==============
NOTICE:  database "pl_regression" does not exist, skipping
DROP DATABASE
============== creating database "pl_regression"      ==============
CREATE DATABASE
ALTER DATABASE
============== installing plperl                      ==============
CREATE EXTENSION
============== installing plperlu                     ==============
CREATE EXTENSION
============== running regression test queries        ==============
test plperl                   ... ok
test plperl_lc                ... ok
test plperl_trigger           ... ok
test plperl_shared            ... ok
test plperl_elog              ... ok
test plperl_util              ... ok
test plperl_init              ... ok
test plperlu                  ... ok
test plperl_array             ... ok
test plperl_plperlu           ... ok

======================
 All 10 tests passed.
======================

On Linux:

LD_LIBRARY_PATH="/home/ashu/git-clone-postgresql/postgresql/tmp_install/home/ashu/git-clone-postgresql/postgresql/TMP/postgres/lib"
../../../src/test/regress/pg_regress --temp-instance=./tmp_check
--inputdir=. --bindir=     --dbname=pl_regression
--load-extension=plperl  --load-extension=plperlu plperl plperl_lc
plperl_trigger plperl_shared plperl_elog plperl_util plperl_init
plperlu plperl_array
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 50848 with PID 18140
============== creating database "pl_regression"      ==============
CREATE DATABASE
ALTER DATABASE
============== installing plperl                      ==============
CREATE EXTENSION
============== installing plperlu                     ==============
CREATE EXTENSION
============== running regression test queries        ==============
test plperl                   ... ok
test plperl_lc                ... ok
test plperl_trigger           ... ok
test plperl_shared            ... ok
test plperl_elog              ... ok
test plperl_util              ... ok
test plperl_init              ... ok
test plperlu                  ... ok
test plperl_array             ... ok
============== shutting down postmaster               ==============
============== removing temporary instance            ==============

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-31 06:11             ` Ashutosh Sharma <ashu.coek88@gmail.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-07-31 06:11 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers

Hi Christoph,

On Mon, Jul 31, 2017 at 9:18 AM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> Hi Christoph,
>
> On Mon, Jul 31, 2017 at 2:44 AM, Christoph Berg <myon@debian.org> wrote:
>> Re: Tom Lane 2017-07-28 <3254.1501276475@sss.pgh.pa.us>
>>> Christoph Berg <myon@debian.org> writes:
>>> > The plperl segfault on Debian's kfreebsd port I reported back in 2013
>>> > is also still present:
>>> > https://www.postgresql.org/message-id/20130515064201.GC704%40msgid.df7cb.de
>>> > https://buildd.debian.org/status/fetch.php?pkg=postgresql-10&arch=kfreebsd-amd64&ver=10~beta...
>>>
>>> So it'd be interesting to know if it's any better with HEAD ...
>>
>> Unfortunately not:
>>
>> ============== creating database "pl_regression"      ==============
>> CREATE DATABASE
>> ALTER DATABASE
>> ============== installing plperl                      ==============
>> server closed the connection unexpectedly
>>         This probably means the server terminated abnormally
>>         before or while processing the request.
>> connection to server was lost
>>
>> The only interesting line in log/postmaster.log is a log_line_prefix-less
>> Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
>> ... which is unchanged from the beta2 output.
>

It seems like you are observing this crash on kFreeBSD OS. Well, me or
any of my colleague is not having this OS hence, i can't comment on
that. But, we do have Ubuntu OS (another Debian based OS) and I am not
seeing any server crash here as well,

edb@ubuntu:~/PGsources/postgresql/src/pl/plperl$ make check
make -C ../../../src/test/regress pg_regress
.....
/bin/mkdir -p '/home/edb/PGsources/postgresql'/tmp_install/log
make -C '../../..'
DESTDIR='/home/edb/PGsources/postgresql'/tmp_install install
>'/home/edb/PGsources/postgresql'/tmp_install/log/install.log 2>&1
PATH="/home/edb/PGsources/postgresql/tmp_install/home/edb/PGsources/postgresql/inst/bin:$PATH"
LD_LIBRARY_PATH="/home/edb/PGsources/postgresql/tmp_install/home/edb/PGsources/postgresql/inst/lib:$LD_LIBRARY_PATH"
../../../src/test/regress/pg_regress --temp-instance=./tmp_check
--inputdir=. --bindir=     --dbname=pl_regression
--load-extension=plperl  --load-extension=plperlu plperl plperl_lc
plperl_trigger plperl_shared plperl_elog plperl_util plperl_init
plperlu plperl_array plperl_plperlu
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 50848 with PID 43441
============== creating database "pl_regression"      ==============
CREATE DATABASE
ALTER DATABASE
============== installing plperl                      ==============
CREATE EXTENSION
============== installing plperlu                     ==============
CREATE EXTENSION
============== running regression test queries        ==============
test plperl                   ... ok
test plperl_lc                ... ok
test plperl_trigger           ... ok
test plperl_shared            ... ok
test plperl_elog              ... ok
test plperl_util              ... ok
test plperl_init              ... ok
test plperlu                  ... ok
test plperl_array             ... ok
test plperl_plperlu           ... ok
============== shutting down postmaster               ==============
============== removing temporary instance            ==============


As i mentioned in my earlier email, could you please delete the Utilc.
and SPI.c files from src/pl/plperl directory, rebuild the source code
and then let us know the results. Thanks.

>
> I am not able to reproduce this issue on my Windows or Linux box. Have
> you deleted Util.c and SPI.c files before starting with the build? The
> point is, these files are generated during build time and if they
> already exist then i think. they are not re generated. I would suggest
> to delete both the .c files and rebuild your source and then give a
> try.
>
> Here are the results i got on Windows and Linux respectively on HEAD,
>
> On Windows:
>
> C:\Users\ashu\git-clone-postgresql\postgresql\src\tools\msvc>vcregress.bat
> PLCHECK
> ============================================================
> Checking plperl
> (using postmaster on localhost, default port)
> ============== dropping database "pl_regression"      ==============
> NOTICE:  database "pl_regression" does not exist, skipping
> DROP DATABASE
> ============== creating database "pl_regression"      ==============
> CREATE DATABASE
> ALTER DATABASE
> ============== installing plperl                      ==============
> CREATE EXTENSION
> ============== installing plperlu                     ==============
> CREATE EXTENSION
> ============== running regression test queries        ==============
> test plperl                   ... ok
> test plperl_lc                ... ok
> test plperl_trigger           ... ok
> test plperl_shared            ... ok
> test plperl_elog              ... ok
> test plperl_util              ... ok
> test plperl_init              ... ok
> test plperlu                  ... ok
> test plperl_array             ... ok
> test plperl_plperlu           ... ok
>
> ======================
>  All 10 tests passed.
> ======================
>
> On Linux:
>
> LD_LIBRARY_PATH="/home/ashu/git-clone-postgresql/postgresql/tmp_install/home/ashu/git-clone-postgresql/postgresql/TMP/postgres/lib"
> ../../../src/test/regress/pg_regress --temp-instance=./tmp_check
> --inputdir=. --bindir=     --dbname=pl_regression
> --load-extension=plperl  --load-extension=plperlu plperl plperl_lc
> plperl_trigger plperl_shared plperl_elog plperl_util plperl_init
> plperlu plperl_array
> ============== creating temporary instance            ==============
> ============== initializing database system           ==============
> ============== starting postmaster                    ==============
> running on port 50848 with PID 18140
> ============== creating database "pl_regression"      ==============
> CREATE DATABASE
> ALTER DATABASE
> ============== installing plperl                      ==============
> CREATE EXTENSION
> ============== installing plperlu                     ==============
> CREATE EXTENSION
> ============== running regression test queries        ==============
> test plperl                   ... ok
> test plperl_lc                ... ok
> test plperl_trigger           ... ok
> test plperl_shared            ... ok
> test plperl_elog              ... ok
> test plperl_util              ... ok
> test plperl_init              ... ok
> test plperlu                  ... ok
> test plperl_array             ... ok
> ============== shutting down postmaster               ==============
> ============== removing temporary instance            ==============
>
> --
> With Regards,
> Ashutosh Sharma
> EnterpriseDB:http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-07-31 08:40             ` Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Christoph Berg @ 2017-07-31 08:40 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers

Re: Ashutosh Sharma 2017-07-31 <CAE9k0PnzYxyKHuwJonUEDt2xunPUc8VUVPWsd0BScRd3u+j8_A@mail.gmail.com>
> > The only interesting line in log/postmaster.log is a log_line_prefix-less
> > Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
> > ... which is unchanged from the beta2 output.
> 
> 
> I am not able to reproduce this issue on my Windows or Linux box. Have
> you deleted Util.c and SPI.c files before starting with the build?

That was from a git checkout which didn't contain the files.
Retrying anyway:

[127] 10:28 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ make clean
rm -f plperl.so   libplperl.a  libplperl.pc
rm -f SPI.c Util.c plperl.o SPI.o Util.o  perlchunks.h plperl_opmask.h
rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
[0] 10:29 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ make
'/usr/bin/perl' ./text2macro.pl --strip='^(\#.*|\s*)$' plc_perlboot.pl plc_trusted.pl > perlchunks.h
'/usr/bin/perl' plperl_opmask.pl plperl_opmask.h
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../../src/include -D_GNU_SOURCE   -I/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE  -c -o plperl.o plperl.c
'/usr/bin/perl' /usr/share/perl/5.26/ExtUtils/xsubpp -typemap /usr/share/perl/5.26/ExtUtils/typemap SPI.xs >SPI.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../../src/include -D_GNU_SOURCE   -I/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE  -c -o SPI.o SPI.c
'/usr/bin/perl' /usr/share/perl/5.26/ExtUtils/xsubpp -typemap /usr/share/perl/5.26/ExtUtils/typemap Util.xs >Util.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../../src/include -D_GNU_SOURCE   -I/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE  -c -o Util.o Util.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -shared -o plperl.so plperl.o SPI.o Util.o  -L../../../src/port -L../../../src/common -Wl,--as-needed -Wl,-rpath,'/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE',--enable-new-dtags  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lc -lcrypt 
[0] 10:29 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ make check
make -C ../../../src/test/regress pg_regress
make[1]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/test/regress“ wird betreten
make -C ../../../src/port all
make[2]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/port“ wird betreten
make -C ../backend submake-errcodes
make[3]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird betreten
make[3]: Für das Ziel „submake-errcodes“ ist nichts zu tun.
make[3]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird verlassen
make[2]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/port“ wird verlassen
make -C ../../../src/common all
make[2]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/common“ wird betreten
make -C ../backend submake-errcodes
make[3]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird betreten
make[3]: Für das Ziel „submake-errcodes“ ist nichts zu tun.
make[3]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird verlassen
make[2]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/common“ wird verlassen
make[1]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/test/regress“ wird verlassen
rm -rf '/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install
/bin/mkdir -p '/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install/log
make -C '../../..' DESTDIR='/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install install >'/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install/log/install.log 2>&1
PATH="/home/myon/postgresql-10/postgresql-10-10~beta2/tmp_install/usr/local/pgsql/bin:$PATH" LD_LIBRARY_PATH="/home/myon/postgresql-10/postgresql-10-10~beta2/tmp_install/usr/local/pgsql/lib" ../../../src/test/regress/pg_regress --temp-instance=./tmp_check --inputdir=. --bindir=     --dbname=pl_regression --load-extension=plperl  --load-extension=plperlu plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array plperl_plperlu
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 50848 with PID 17713
============== creating database "pl_regression"      ==============
CREATE DATABASE
ALTER DATABASE
============== installing plperl                      ==============
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
connection to server was lost
command failed: "psql" -X -c "CREATE EXTENSION IF NOT EXISTS \"plperl\"" "pl_regression"
GNUmakefile:108: die Regel für Ziel „check“ scheiterte
make: *** [check] Fehler 2
[2] 10:29 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ cat log/postmaster.log 
2017-07-31 10:29:54.995 CEST [17713] LOG:  listening on Unix socket "/tmp/pg_regress-JaWXuT/.s.PGSQL.50848"
2017-07-31 10:29:55.015 CEST [17716] LOG:  database system was shut down at 2017-07-31 10:29:54 CEST
2017-07-31 10:29:55.023 CEST [17713] LOG:  database system is ready to accept connections
2017-07-31 10:29:56.068 CEST [17717] LOG:  checkpoint starting: immediate force wait flush-all
2017-07-31 10:29:56.071 CEST [17717] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.000 s, total=0.002 s; sync files=0, longest=0.000 s, average=0.000 s; distance=1 kB, estimate=1 kB
2017-07-31 10:29:56.303 CEST [17717] LOG:  checkpoint starting: immediate force wait
2017-07-31 10:29:56.305 CEST [17717] LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.000 s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=1 kB
Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
2017-07-31 10:29:56.478 CEST [17713] LOG:  received fast shutdown request
2017-07-31 10:29:56.478 CEST [17713] LOG:  aborting any active transactions
2017-07-31 10:29:56.480 CEST [17713] LOG:  worker process: logical replication launcher (PID 17722) exited with exit code 1
2017-07-31 10:29:56.481 CEST [17717] LOG:  shutting down
2017-07-31 10:29:56.481 CEST [17717] LOG:  checkpoint starting: shutdown immediate
2017-07-31 10:29:56.484 CEST [17717] LOG:  checkpoint complete: wrote 19 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.000 s, total=0.003 s; sync files=0, longest=0.000 s, average=0.000 s; distance=47 kB, estimate=47 kB
2017-07-31 10:29:56.494 CEST [17713] LOG:  database system is shut down


Christoph

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

SPI.c (text/x-csrc, 11.9K) download /* * This file was generated automatically by ExtUtils::ParseXS version 3.34 from the * contents of SPI.xs. Do not edit this file, edit SPI.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "SPI.xs" /********************************************************************** * PostgreSQL::InServer::SPI * * SPI interface for plperl. * * src/pl/plperl/SPI.xs * **********************************************************************/ /* this must be first: */ #include "postgres.h" #include "mb/pg_wchar.h" /* for GetDatabaseEncoding */ /* Defined by Perl */ #undef _ /* perl stuff */ #include "plperl.h" #include "plperl_helpers.h" /* * Interface routine to catch ereports and punt them to Perl */ static void do_plperl_return_next(SV *sv) { MemoryContext oldcontext = CurrentMemoryContext; PG_TRY(); { plperl_return_next(sv); } PG_CATCH(); { ErrorData *edata; /* Must reset elog.c's state */ MemoryContextSwitchTo(oldcontext); edata = CopyErrorData(); FlushErrorState(); /* Punt the error to Perl */ croak_cstr(edata->message); } PG_END_TRY(); } #line 60 "SPI.c" #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(var) if (0) var = var #endif #ifndef dVAR # define dVAR dNOOP #endif /* This stuff is not part of the API! You have been warned. */ #ifndef PERL_VERSION_DECIMAL # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) #endif #ifndef PERL_DECIMAL_VERSION # define PERL_DECIMAL_VERSION \ PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) #endif #ifndef PERL_VERSION_GE # define PERL_VERSION_GE(r,v,s) \ (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) #endif #ifndef PERL_VERSION_LE # define PERL_VERSION_LE(r,v,s) \ (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) #endif /* XS_INTERNAL is the explicit static-linkage variant of the default * XS macro. * * XS_EXTERNAL is the same as XS_INTERNAL except it does not include * "STATIC", ie. it exports XSUB symbols. You probably don't want that * for anything but the BOOT XSUB. * * See XSUB.h in core! */ /* TODO: This might be compatible further back than 5.10.0. */ #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) # undef XS_EXTERNAL # undef XS_INTERNAL # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) # define XS_INTERNAL(name) STATIC XSPROTO(name) # endif # if defined(__SYMBIAN32__) # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) # endif # ifndef XS_EXTERNAL # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) # else # ifdef __cplusplus # define XS_EXTERNAL(name) extern "C" XSPROTO(name) # define XS_INTERNAL(name) static XSPROTO(name) # else # define XS_EXTERNAL(name) XSPROTO(name) # define XS_INTERNAL(name) STATIC XSPROTO(name) # endif # endif # endif #endif /* perl >= 5.10.0 && perl <= 5.15.1 */ /* The XS_EXTERNAL macro is used for functions that must not be static * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL * macro defined, the best we can do is assume XS is the same. * Dito for XS_INTERNAL. */ #ifndef XS_EXTERNAL # define XS_EXTERNAL(name) XS(name) #endif #ifndef XS_INTERNAL # define XS_INTERNAL(name) XS(name) #endif /* Now, finally, after all this mess, we want an ExtUtils::ParseXS * internal macro that we're free to redefine for varying linkage due * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! */ #undef XS_EUPXS #if defined(PERL_EUPXS_ALWAYS_EXPORT) # define XS_EUPXS(name) XS_EXTERNAL(name) #else /* default to internal */ # define XS_EUPXS(name) XS_INTERNAL(name) #endif #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) /* prototype to pass -Wmissing-prototypes */ STATIC void S_croak_xs_usage(const CV *const cv, const char *const params); STATIC void S_croak_xs_usage(const CV *const cv, const char *const params) { const GV *const gv = CvGV(cv); PERL_ARGS_ASSERT_CROAK_XS_USAGE; if (gv) { const char *const gvname = GvNAME(gv); const HV *const stash = GvSTASH(gv); const char *const hvname = stash ? HvNAME(stash) : NULL; if (hvname) Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); else Perl_croak_nocontext("Usage: %s(%s)", gvname, params); } else { /* Pants. I don't think that it should be possible to get here. */ Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); } } #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE #define croak_xs_usage S_croak_xs_usage #endif /* NOTE: the prototype of newXSproto() is different in versions of perls, * so we define a portable version of newXSproto() */ #ifdef newXS_flags #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) #else #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) #endif /* !defined(newXS_flags) */ #if PERL_VERSION_LE(5, 21, 5) # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) #else # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) #endif #line 204 "SPI.c" XS_EUPXS(XS__spi_exec_query); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_exec_query) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "sv, ..."); { SV* sv = ST(0) ; #line 59 "SPI.xs" HV *ret_hash; int limit = 0; char *query; #line 219 "SPI.c" SV * RETVAL; #line 63 "SPI.xs" if (items > 2) croak("Usage: spi_exec_query(query, limit) " "or spi_exec_query(query)"); if (items == 2) limit = SvIV(ST(1)); query = sv2cstr(sv); ret_hash = plperl_spi_exec(query, limit); pfree(query); RETVAL = newRV_noinc((SV*) ret_hash); #line 231 "SPI.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__return_next); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__return_next) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "rv"); { SV * rv = ST(0) ; #line 79 "SPI.xs" do_plperl_return_next(rv); #line 250 "SPI.c" } XSRETURN_EMPTY; } XS_EUPXS(XS__spi_query); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_query) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; SV * RETVAL; #line 85 "SPI.xs" char* query = sv2cstr(sv); RETVAL = plperl_spi_query(query); pfree(query); #line 270 "SPI.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__spi_fetchrow); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_fetchrow) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV* sv = ST(0) ; SV * RETVAL; #line 95 "SPI.xs" char* cursor = sv2cstr(sv); RETVAL = plperl_spi_fetchrow(cursor); pfree(cursor); #line 292 "SPI.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__spi_prepare); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_prepare) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "sv, ..."); { SV* sv = ST(0) ; SV * RETVAL; #line 105 "SPI.xs" int i; SV** argv; char* query = sv2cstr(sv); if (items < 1) Perl_croak(aTHX_ "Usage: spi_prepare(query, ...)"); argv = ( SV**) palloc(( items - 1) * sizeof(SV*)); for ( i = 1; i < items; i++) argv[i - 1] = ST(i); RETVAL = plperl_spi_prepare(query, items - 1, argv); pfree( argv); pfree(query); #line 322 "SPI.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__spi_exec_prepared); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_exec_prepared) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "sv, ..."); { SV* sv = ST(0) ; #line 123 "SPI.xs" HV *ret_hash; #line 341 "SPI.c" SV * RETVAL; #line 125 "SPI.xs" HV *attr = NULL; int i, offset = 1, argc; SV ** argv; char *query = sv2cstr(sv); if ( items < 1) Perl_croak(aTHX_ "Usage: spi_exec_prepared(query, [\\%%attr,] " "[\\@bind_values])"); if ( items > 1 && SvROK( ST( 1)) && SvTYPE( SvRV( ST( 1))) == SVt_PVHV) { attr = ( HV*) SvRV(ST(1)); offset++; } argc = items - offset; argv = ( SV**) palloc( argc * sizeof(SV*)); for ( i = 0; offset < items; offset++, i++) argv[i] = ST(offset); ret_hash = plperl_spi_exec_prepared(query, attr, argc, argv); RETVAL = newRV_noinc((SV*)ret_hash); pfree( argv); pfree(query); #line 364 "SPI.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__spi_query_prepared); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_query_prepared) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "sv, ..."); { SV * sv = ST(0) ; SV * RETVAL; #line 152 "SPI.xs" int i; SV ** argv; char *query = sv2cstr(sv); if ( items < 1) Perl_croak(aTHX_ "Usage: spi_query_prepared(query, " "[\\@bind_values])"); argv = ( SV**) palloc(( items - 1) * sizeof(SV*)); for ( i = 1; i < items; i++) argv[i - 1] = ST(i); RETVAL = plperl_spi_query_prepared(query, items - 1, argv); pfree( argv); pfree(query); #line 395 "SPI.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__spi_freeplan); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_freeplan) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; #line 171 "SPI.xs" char *query = sv2cstr(sv); plperl_spi_freeplan(query); pfree(query); #line 416 "SPI.c" } XSRETURN_EMPTY; } XS_EUPXS(XS__spi_cursor_close); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__spi_cursor_close) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; #line 179 "SPI.xs" char *cursor = sv2cstr(sv); plperl_spi_cursor_close(cursor); pfree(cursor); #line 435 "SPI.c" } XSRETURN_EMPTY; } #ifdef __cplusplus extern "C" #endif XS_EXTERNAL(boot_PostgreSQL__InServer__SPI); /* prototype to pass -Wmissing-prototypes */ XS_EXTERNAL(boot_PostgreSQL__InServer__SPI) { #if PERL_VERSION_LE(5, 21, 5) dVAR; dXSARGS; #else dVAR; dXSBOOTARGSAPIVERCHK; #endif #if (PERL_REVISION == 5 && PERL_VERSION < 9) char* file = __FILE__; #else const char* file = __FILE__; #endif PERL_UNUSED_VAR(file); PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ #if PERL_VERSION_LE(5, 21, 5) && defined(XS_APIVERSION_BOOTCHECK) XS_APIVERSION_BOOTCHECK; #endif (void)newXSproto_portable("spi_exec_query", XS__spi_exec_query, file, "$;@"); (void)newXSproto_portable("return_next", XS__return_next, file, "$"); (void)newXSproto_portable("spi_query", XS__spi_query, file, "$"); (void)newXSproto_portable("spi_fetchrow", XS__spi_fetchrow, file, "$"); (void)newXSproto_portable("spi_prepare", XS__spi_prepare, file, "$;@"); (void)newXSproto_portable("spi_exec_prepared", XS__spi_exec_prepared, file, "$;@"); (void)newXSproto_portable("spi_query_prepared", XS__spi_query_prepared, file, "$;@"); (void)newXSproto_portable("spi_freeplan", XS__spi_freeplan, file, "$"); (void)newXSproto_portable("spi_cursor_close", XS__spi_cursor_close, file, "$"); /* Initialisation Section */ #line 185 "SPI.xs" items = 0; /* avoid 'unused variable' warning */ #line 480 "SPI.c" /* End of Initialisation Section */ #if PERL_VERSION_LE(5, 21, 5) # if PERL_VERSION_GE(5, 9, 0) if (PL_unitcheckav) call_list(PL_scopestack_ix, PL_unitcheckav); # endif XSRETURN_YES; #else Perl_xs_boot_epilog(aTHX_ ax); #endif }
Util.c (text/x-csrc, 13.7K) download /* * This file was generated automatically by ExtUtils::ParseXS version 3.34 from the * contents of Util.xs. Do not edit this file, edit Util.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "Util.xs" /********************************************************************** * PostgreSQL::InServer::Util * * src/pl/plperl/Util.xs * * Defines plperl interfaces for general-purpose utilities. * This module is bootstrapped as soon as an interpreter is initialized. * Currently doesn't define a PACKAGE= so all subs are in main:: to avoid * the need for explicit importing. * **********************************************************************/ /* this must be first: */ #include "postgres.h" #include "fmgr.h" #include "utils/builtins.h" #include "utils/bytea.h" /* for byteain & byteaout */ #include "mb/pg_wchar.h" /* for GetDatabaseEncoding */ /* Defined by Perl */ #undef _ /* perl stuff */ #include "plperl.h" #include "plperl_helpers.h" /* * Implementation of plperl's elog() function * * If the error level is less than ERROR, we'll just emit the message and * return. When it is ERROR, elog() will longjmp, which we catch and * turn into a Perl croak(). Note we are assuming that elog() can't have * any internal failures that are so bad as to require a transaction abort. * * This is out-of-line to suppress "might be clobbered by longjmp" warnings. */ static void do_util_elog(int level, SV *msg) { MemoryContext oldcontext = CurrentMemoryContext; char * volatile cmsg = NULL; PG_TRY(); { cmsg = sv2cstr(msg); elog(level, "%s", cmsg); pfree(cmsg); } PG_CATCH(); { ErrorData *edata; /* Must reset elog.c's state */ MemoryContextSwitchTo(oldcontext); edata = CopyErrorData(); FlushErrorState(); if (cmsg) pfree(cmsg); /* Punt the error to Perl */ croak_cstr(edata->message); } PG_END_TRY(); } static text * sv2text(SV *sv) { char *str = sv2cstr(sv); text *text; text = cstring_to_text(str); pfree(str); return text; } #line 87 "Util.c" #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(var) if (0) var = var #endif #ifndef dVAR # define dVAR dNOOP #endif /* This stuff is not part of the API! You have been warned. */ #ifndef PERL_VERSION_DECIMAL # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) #endif #ifndef PERL_DECIMAL_VERSION # define PERL_DECIMAL_VERSION \ PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) #endif #ifndef PERL_VERSION_GE # define PERL_VERSION_GE(r,v,s) \ (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) #endif #ifndef PERL_VERSION_LE # define PERL_VERSION_LE(r,v,s) \ (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) #endif /* XS_INTERNAL is the explicit static-linkage variant of the default * XS macro. * * XS_EXTERNAL is the same as XS_INTERNAL except it does not include * "STATIC", ie. it exports XSUB symbols. You probably don't want that * for anything but the BOOT XSUB. * * See XSUB.h in core! */ /* TODO: This might be compatible further back than 5.10.0. */ #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) # undef XS_EXTERNAL # undef XS_INTERNAL # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) # define XS_INTERNAL(name) STATIC XSPROTO(name) # endif # if defined(__SYMBIAN32__) # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) # endif # ifndef XS_EXTERNAL # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) # else # ifdef __cplusplus # define XS_EXTERNAL(name) extern "C" XSPROTO(name) # define XS_INTERNAL(name) static XSPROTO(name) # else # define XS_EXTERNAL(name) XSPROTO(name) # define XS_INTERNAL(name) STATIC XSPROTO(name) # endif # endif # endif #endif /* perl >= 5.10.0 && perl <= 5.15.1 */ /* The XS_EXTERNAL macro is used for functions that must not be static * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL * macro defined, the best we can do is assume XS is the same. * Dito for XS_INTERNAL. */ #ifndef XS_EXTERNAL # define XS_EXTERNAL(name) XS(name) #endif #ifndef XS_INTERNAL # define XS_INTERNAL(name) XS(name) #endif /* Now, finally, after all this mess, we want an ExtUtils::ParseXS * internal macro that we're free to redefine for varying linkage due * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! */ #undef XS_EUPXS #if defined(PERL_EUPXS_ALWAYS_EXPORT) # define XS_EUPXS(name) XS_EXTERNAL(name) #else /* default to internal */ # define XS_EUPXS(name) XS_INTERNAL(name) #endif #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) /* prototype to pass -Wmissing-prototypes */ STATIC void S_croak_xs_usage(const CV *const cv, const char *const params); STATIC void S_croak_xs_usage(const CV *const cv, const char *const params) { const GV *const gv = CvGV(cv); PERL_ARGS_ASSERT_CROAK_XS_USAGE; if (gv) { const char *const gvname = GvNAME(gv); const HV *const stash = GvSTASH(gv); const char *const hvname = stash ? HvNAME(stash) : NULL; if (hvname) Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); else Perl_croak_nocontext("Usage: %s(%s)", gvname, params); } else { /* Pants. I don't think that it should be possible to get here. */ Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); } } #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE #define croak_xs_usage S_croak_xs_usage #endif /* NOTE: the prototype of newXSproto() is different in versions of perls, * so we define a portable version of newXSproto() */ #ifdef newXS_flags #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) #else #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) #endif /* !defined(newXS_flags) */ #if PERL_VERSION_LE(5, 21, 5) # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) #else # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) #endif #line 231 "Util.c" XS_EUPXS(XS___aliased_constants); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS___aliased_constants) { dVAR; dXSARGS; dXSI32; if (items != 0) croak_xs_usage(cv, ""); { int RETVAL; dXSTARG; #line 93 "Util.xs" /* uses the ALIAS value as the return value */ RETVAL = ix; #line 246 "Util.c" XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } XS_EUPXS(XS__elog); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__elog) { dVAR; dXSARGS; if (items != 2) croak_xs_usage(cv, "level, msg"); { int level = (int)SvIV(ST(0)) ; SV * msg = ST(1) ; #line 104 "Util.xs" if (level > ERROR) /* no PANIC allowed thanks */ level = ERROR; if (level < DEBUG5) level = DEBUG5; do_util_elog(level, msg); #line 270 "Util.c" } XSRETURN_EMPTY; } XS_EUPXS(XS__quote_literal); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__quote_literal) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; SV * RETVAL; #line 114 "Util.xs" if (!sv || !SvOK(sv)) { RETVAL = &PL_sv_undef; } else { text *arg = sv2text(sv); text *quoted = DatumGetTextPP(DirectFunctionCall1(quote_literal, PointerGetDatum(arg))); char *str; pfree(arg); str = text_to_cstring(quoted); RETVAL = cstr2sv(str); pfree(str); } #line 300 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__quote_nullable); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__quote_nullable) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; SV * RETVAL; #line 134 "Util.xs" if (!sv || !SvOK(sv)) { RETVAL = cstr2sv("NULL"); } else { text *arg = sv2text(sv); text *quoted = DatumGetTextPP(DirectFunctionCall1(quote_nullable, PointerGetDatum(arg))); char *str; pfree(arg); str = text_to_cstring(quoted); RETVAL = cstr2sv(str); pfree(str); } #line 334 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__quote_ident); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__quote_ident) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; #line 156 "Util.xs" text *arg; text *quoted; char *str; #line 355 "Util.c" SV * RETVAL; #line 160 "Util.xs" arg = sv2text(sv); quoted = DatumGetTextPP(DirectFunctionCall1(quote_ident, PointerGetDatum(arg))); pfree(arg); str = text_to_cstring(quoted); RETVAL = cstr2sv(str); pfree(str); #line 365 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__decode_bytea); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__decode_bytea) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; #line 174 "Util.xs" char *arg; text *ret; #line 385 "Util.c" SV * RETVAL; #line 177 "Util.xs" arg = SvPVbyte_nolen(sv); ret = DatumGetTextPP(DirectFunctionCall1(byteain, PointerGetDatum(arg))); /* not cstr2sv because this is raw bytes not utf8'able */ RETVAL = newSVpvn(VARDATA_ANY(ret), VARSIZE_ANY_EXHDR(ret)); #line 392 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__encode_bytea); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__encode_bytea) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; #line 188 "Util.xs" text *arg; char *ret; STRLEN len; #line 413 "Util.c" SV * RETVAL; #line 192 "Util.xs" /* not sv2text because this is raw bytes not utf8'able */ ret = SvPVbyte(sv, len); arg = cstring_to_text_with_len(ret, len); ret = DatumGetCString(DirectFunctionCall1(byteaout, PointerGetDatum(arg))); RETVAL = cstr2sv(ret); #line 421 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__looks_like_number); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__looks_like_number) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "sv"); { SV * sv = ST(0) ; SV * RETVAL; #line 204 "Util.xs" if (!SvOK(sv)) RETVAL = &PL_sv_undef; else if ( looks_like_number(sv) ) RETVAL = &PL_sv_yes; else RETVAL = &PL_sv_no; #line 446 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } XS_EUPXS(XS__encode_typed_literal); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS__encode_typed_literal) { dVAR; dXSARGS; if (items != 2) croak_xs_usage(cv, "sv, typname"); { SV * sv = ST(0) ; char * typname = (char *)SvPV_nolen(ST(1)) ; #line 218 "Util.xs" char *outstr; #line 467 "Util.c" SV * RETVAL; #line 220 "Util.xs" outstr = plperl_sv_to_literal(sv, typname); if (outstr == NULL) RETVAL = &PL_sv_undef; else RETVAL = cstr2sv(outstr); #line 475 "Util.c" RETVAL = sv_2mortal(RETVAL); ST(0) = RETVAL; } XSRETURN(1); } #ifdef __cplusplus extern "C" #endif XS_EXTERNAL(boot_PostgreSQL__InServer__Util); /* prototype to pass -Wmissing-prototypes */ XS_EXTERNAL(boot_PostgreSQL__InServer__Util) { #if PERL_VERSION_LE(5, 21, 5) dVAR; dXSARGS; #else dVAR; dXSBOOTARGSAPIVERCHK; #endif #if (PERL_REVISION == 5 && PERL_VERSION < 9) char* file = __FILE__; #else const char* file = __FILE__; #endif PERL_UNUSED_VAR(file); PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ #if PERL_VERSION_LE(5, 21, 5) && defined(XS_APIVERSION_BOOTCHECK) XS_APIVERSION_BOOTCHECK; #endif cv = newXSproto_portable("DEBUG", XS___aliased_constants, file, ""); XSANY.any_i32 = DEBUG2; cv = newXSproto_portable("ERROR", XS___aliased_constants, file, ""); XSANY.any_i32 = ERROR; cv = newXSproto_portable("INFO", XS___aliased_constants, file, ""); XSANY.any_i32 = INFO; cv = newXSproto_portable("LOG", XS___aliased_constants, file, ""); XSANY.any_i32 = LOG; cv = newXSproto_portable("NOTICE", XS___aliased_constants, file, ""); XSANY.any_i32 = NOTICE; cv = newXSproto_portable("WARNING", XS___aliased_constants, file, ""); XSANY.any_i32 = WARNING; cv = newXSproto_portable("_aliased_constants", XS___aliased_constants, file, ""); XSANY.any_i32 = 0; (void)newXSproto_portable("elog", XS__elog, file, "$$"); (void)newXSproto_portable("quote_literal", XS__quote_literal, file, "$"); (void)newXSproto_portable("quote_nullable", XS__quote_nullable, file, "$"); (void)newXSproto_portable("quote_ident", XS__quote_ident, file, "$"); (void)newXSproto_portable("decode_bytea", XS__decode_bytea, file, "$"); (void)newXSproto_portable("encode_bytea", XS__encode_bytea, file, "$"); (void)newXSproto_portable("looks_like_number", XS__looks_like_number, file, "$"); (void)newXSproto_portable("encode_typed_literal", XS__encode_typed_literal, file, "$$"); /* Initialisation Section */ #line 229 "Util.xs" items = 0; /* avoid 'unused variable' warning */ #line 535 "Util.c" /* End of Initialisation Section */ #if PERL_VERSION_LE(5, 21, 5) # if PERL_VERSION_GE(5, 9, 0) if (PL_unitcheckav) call_list(PL_scopestack_ix, PL_unitcheckav); # endif XSRETURN_YES; #else Perl_xs_boot_epilog(aTHX_ ax); #endif }
plperl_opmask.h (text/x-chdr, 13.1K) download #define PLPERL_SET_OPMASK(opmask) \ memset(opmask, 1, MAXO); /* disable all */ \ /* then allow some... */ \ /* ALLOWED: :default :base_math !:base_io sort time require entereval caller dofile print prtf !dbmopen !setpgrp !setpriority !custom */ \ opmask[OP_NULL ] = 0; /* null operation */ \ opmask[OP_STUB ] = 0; /* stub */ \ opmask[OP_SCALAR ] = 0; /* scalar */ \ opmask[OP_PUSHMARK ] = 0; /* pushmark */ \ opmask[OP_WANTARRAY ] = 0; /* wantarray */ \ opmask[OP_CONST ] = 0; /* constant item */ \ opmask[OP_GVSV ] = 0; /* scalar variable */ \ opmask[OP_GV ] = 0; /* glob value */ \ opmask[OP_GELEM ] = 0; /* glob elem */ \ opmask[OP_PADSV ] = 0; /* private variable */ \ opmask[OP_PADAV ] = 0; /* private array */ \ opmask[OP_PADHV ] = 0; /* private hash */ \ opmask[OP_PADANY ] = 0; /* private value */ \ opmask[OP_RV2GV ] = 0; /* ref-to-glob cast */ \ opmask[OP_RV2SV ] = 0; /* scalar dereference */ \ opmask[OP_AV2ARYLEN ] = 0; /* array length */ \ opmask[OP_RV2CV ] = 0; /* subroutine dereference */ \ opmask[OP_ANONCODE ] = 0; /* anonymous subroutine */ \ opmask[OP_PROTOTYPE ] = 0; /* subroutine prototype */ \ opmask[OP_REFGEN ] = 0; /* reference constructor */ \ opmask[OP_SREFGEN ] = 0; /* single ref constructor */ \ opmask[OP_REF ] = 0; /* reference-type operator */ \ opmask[OP_BLESS ] = 0; /* bless */ \ opmask[OP_REGCMAYBE ] = 0; /* regexp internal guard */ \ opmask[OP_REGCRESET ] = 0; /* regexp internal reset */ \ opmask[OP_REGCOMP ] = 0; /* regexp compilation */ \ opmask[OP_MATCH ] = 0; /* pattern match (m//) */ \ opmask[OP_QR ] = 0; /* pattern quote (qr//) */ \ opmask[OP_SUBST ] = 0; /* substitution (s///) */ \ opmask[OP_SUBSTCONT ] = 0; /* substitution iterator */ \ opmask[OP_TRANS ] = 0; /* transliteration (tr///) */ \ opmask[OP_TRANSR ] = 0; /* transliteration (tr///) */ \ opmask[OP_SASSIGN ] = 0; /* scalar assignment */ \ opmask[OP_AASSIGN ] = 0; /* list assignment */ \ opmask[OP_CHOP ] = 0; /* chop */ \ opmask[OP_SCHOP ] = 0; /* scalar chop */ \ opmask[OP_CHOMP ] = 0; /* chomp */ \ opmask[OP_SCHOMP ] = 0; /* scalar chomp */ \ opmask[OP_DEFINED ] = 0; /* defined operator */ \ opmask[OP_UNDEF ] = 0; /* undef operator */ \ opmask[OP_STUDY ] = 0; /* study */ \ opmask[OP_POS ] = 0; /* match position */ \ opmask[OP_PREINC ] = 0; /* preincrement (++) */ \ opmask[OP_I_PREINC ] = 0; /* integer preincrement (++) */ \ opmask[OP_PREDEC ] = 0; /* predecrement (--) */ \ opmask[OP_I_PREDEC ] = 0; /* integer predecrement (--) */ \ opmask[OP_POSTINC ] = 0; /* postincrement (++) */ \ opmask[OP_I_POSTINC ] = 0; /* integer postincrement (++) */ \ opmask[OP_POSTDEC ] = 0; /* postdecrement (--) */ \ opmask[OP_I_POSTDEC ] = 0; /* integer postdecrement (--) */ \ opmask[OP_POW ] = 0; /* exponentiation (**) */ \ opmask[OP_MULTIPLY ] = 0; /* multiplication (*) */ \ opmask[OP_I_MULTIPLY ] = 0; /* integer multiplication (*) */ \ opmask[OP_DIVIDE ] = 0; /* division (/) */ \ opmask[OP_I_DIVIDE ] = 0; /* integer division (/) */ \ opmask[OP_MODULO ] = 0; /* modulus (%) */ \ opmask[OP_I_MODULO ] = 0; /* integer modulus (%) */ \ opmask[OP_REPEAT ] = 0; /* repeat (x) */ \ opmask[OP_ADD ] = 0; /* addition (+) */ \ opmask[OP_I_ADD ] = 0; /* integer addition (+) */ \ opmask[OP_SUBTRACT ] = 0; /* subtraction (-) */ \ opmask[OP_I_SUBTRACT ] = 0; /* integer subtraction (-) */ \ opmask[OP_CONCAT ] = 0; /* concatenation (.) or string */ \ opmask[OP_STRINGIFY ] = 0; /* string */ \ opmask[OP_LEFT_SHIFT ] = 0; /* left bitshift (<<) */ \ opmask[OP_RIGHT_SHIFT ] = 0; /* right bitshift (>>) */ \ opmask[OP_LT ] = 0; /* numeric lt (<) */ \ opmask[OP_I_LT ] = 0; /* integer lt (<) */ \ opmask[OP_GT ] = 0; /* numeric gt (>) */ \ opmask[OP_I_GT ] = 0; /* integer gt (>) */ \ opmask[OP_LE ] = 0; /* numeric le (<=) */ \ opmask[OP_I_LE ] = 0; /* integer le (<=) */ \ opmask[OP_GE ] = 0; /* numeric ge (>=) */ \ opmask[OP_I_GE ] = 0; /* integer ge (>=) */ \ opmask[OP_EQ ] = 0; /* numeric eq (==) */ \ opmask[OP_I_EQ ] = 0; /* integer eq (==) */ \ opmask[OP_NE ] = 0; /* numeric ne (!=) */ \ opmask[OP_I_NE ] = 0; /* integer ne (!=) */ \ opmask[OP_NCMP ] = 0; /* numeric comparison (<=>) */ \ opmask[OP_I_NCMP ] = 0; /* integer comparison (<=>) */ \ opmask[OP_SLT ] = 0; /* string lt */ \ opmask[OP_SGT ] = 0; /* string gt */ \ opmask[OP_SLE ] = 0; /* string le */ \ opmask[OP_SGE ] = 0; /* string ge */ \ opmask[OP_SEQ ] = 0; /* string eq */ \ opmask[OP_SNE ] = 0; /* string ne */ \ opmask[OP_SCMP ] = 0; /* string comparison (cmp) */ \ opmask[OP_BIT_AND ] = 0; /* bitwise and (&) */ \ opmask[OP_BIT_XOR ] = 0; /* bitwise xor (^) */ \ opmask[OP_BIT_OR ] = 0; /* bitwise or (|) */ \ opmask[OP_NBIT_AND ] = 0; /* numeric bitwise and (&) */ \ opmask[OP_NBIT_XOR ] = 0; /* numeric bitwise xor (^) */ \ opmask[OP_NBIT_OR ] = 0; /* numeric bitwise or (|) */ \ opmask[OP_SBIT_AND ] = 0; /* string bitwise and (&.) */ \ opmask[OP_SBIT_XOR ] = 0; /* string bitwise xor (^.) */ \ opmask[OP_SBIT_OR ] = 0; /* string bitwise or (|.) */ \ opmask[OP_NEGATE ] = 0; /* negation (-) */ \ opmask[OP_I_NEGATE ] = 0; /* integer negation (-) */ \ opmask[OP_NOT ] = 0; /* not */ \ opmask[OP_COMPLEMENT ] = 0; /* 1's complement (~) */ \ opmask[OP_NCOMPLEMENT ] = 0; /* numeric 1's complement (~) */ \ opmask[OP_SCOMPLEMENT ] = 0; /* string 1's complement (~) */ \ opmask[OP_SMARTMATCH ] = 0; /* smart match */ \ opmask[OP_ATAN2 ] = 0; /* atan2 */ \ opmask[OP_SIN ] = 0; /* sin */ \ opmask[OP_COS ] = 0; /* cos */ \ opmask[OP_RAND ] = 0; /* rand */ \ opmask[OP_SRAND ] = 0; /* srand */ \ opmask[OP_EXP ] = 0; /* exp */ \ opmask[OP_LOG ] = 0; /* log */ \ opmask[OP_SQRT ] = 0; /* sqrt */ \ opmask[OP_INT ] = 0; /* int */ \ opmask[OP_HEX ] = 0; /* hex */ \ opmask[OP_OCT ] = 0; /* oct */ \ opmask[OP_ABS ] = 0; /* abs */ \ opmask[OP_LENGTH ] = 0; /* length */ \ opmask[OP_SUBSTR ] = 0; /* substr */ \ opmask[OP_VEC ] = 0; /* vec */ \ opmask[OP_INDEX ] = 0; /* index */ \ opmask[OP_RINDEX ] = 0; /* rindex */ \ opmask[OP_SPRINTF ] = 0; /* sprintf */ \ opmask[OP_ORD ] = 0; /* ord */ \ opmask[OP_CHR ] = 0; /* chr */ \ opmask[OP_CRYPT ] = 0; /* crypt */ \ opmask[OP_UCFIRST ] = 0; /* ucfirst */ \ opmask[OP_LCFIRST ] = 0; /* lcfirst */ \ opmask[OP_UC ] = 0; /* uc */ \ opmask[OP_LC ] = 0; /* lc */ \ opmask[OP_QUOTEMETA ] = 0; /* quotemeta */ \ opmask[OP_RV2AV ] = 0; /* array dereference */ \ opmask[OP_AELEMFAST ] = 0; /* constant array element */ \ opmask[OP_AELEMFAST_LEX] = 0; /* constant lexical array element */ \ opmask[OP_AELEM ] = 0; /* array element */ \ opmask[OP_ASLICE ] = 0; /* array slice */ \ opmask[OP_KVASLICE ] = 0; /* index/value array slice */ \ opmask[OP_AEACH ] = 0; /* each on array */ \ opmask[OP_AVALUES ] = 0; /* values on array */ \ opmask[OP_AKEYS ] = 0; /* keys on array */ \ opmask[OP_EACH ] = 0; /* each */ \ opmask[OP_VALUES ] = 0; /* values */ \ opmask[OP_KEYS ] = 0; /* keys */ \ opmask[OP_DELETE ] = 0; /* delete */ \ opmask[OP_EXISTS ] = 0; /* exists */ \ opmask[OP_RV2HV ] = 0; /* hash dereference */ \ opmask[OP_HELEM ] = 0; /* hash element */ \ opmask[OP_HSLICE ] = 0; /* hash slice */ \ opmask[OP_KVHSLICE ] = 0; /* key/value hash slice */ \ opmask[OP_MULTIDEREF ] = 0; /* array or hash lookup */ \ opmask[OP_SPLIT ] = 0; /* split */ \ opmask[OP_JOIN ] = 0; /* join or string */ \ opmask[OP_LIST ] = 0; /* list */ \ opmask[OP_LSLICE ] = 0; /* list slice */ \ opmask[OP_ANONLIST ] = 0; /* anonymous array ([]) */ \ opmask[OP_ANONHASH ] = 0; /* anonymous hash ({}) */ \ opmask[OP_SPLICE ] = 0; /* splice */ \ opmask[OP_PUSH ] = 0; /* push */ \ opmask[OP_POP ] = 0; /* pop */ \ opmask[OP_SHIFT ] = 0; /* shift */ \ opmask[OP_UNSHIFT ] = 0; /* unshift */ \ opmask[OP_SORT ] = 0; /* sort */ \ opmask[OP_REVERSE ] = 0; /* reverse */ \ opmask[OP_GREPSTART ] = 0; /* grep */ \ opmask[OP_GREPWHILE ] = 0; /* grep iterator */ \ opmask[OP_MAPSTART ] = 0; /* map */ \ opmask[OP_MAPWHILE ] = 0; /* map iterator */ \ opmask[OP_RANGE ] = 0; /* flipflop */ \ opmask[OP_FLIP ] = 0; /* range (or flip) */ \ opmask[OP_FLOP ] = 0; /* range (or flop) */ \ opmask[OP_AND ] = 0; /* logical and (&&) */ \ opmask[OP_OR ] = 0; /* logical or (||) */ \ opmask[OP_XOR ] = 0; /* logical xor */ \ opmask[OP_DOR ] = 0; /* defined or (//) */ \ opmask[OP_COND_EXPR ] = 0; /* conditional expression */ \ opmask[OP_ANDASSIGN ] = 0; /* logical and assignment (&&=) */ \ opmask[OP_ORASSIGN ] = 0; /* logical or assignment (||=) */ \ opmask[OP_DORASSIGN ] = 0; /* defined or assignment (//=) */ \ opmask[OP_METHOD ] = 0; /* method lookup */ \ opmask[OP_ENTERSUB ] = 0; /* subroutine entry */ \ opmask[OP_LEAVESUB ] = 0; /* subroutine exit */ \ opmask[OP_LEAVESUBLV ] = 0; /* lvalue subroutine return */ \ opmask[OP_ARGCHECK ] = 0; /* check subroutine arguments */ \ opmask[OP_ARGELEM ] = 0; /* subroutine argument */ \ opmask[OP_ARGDEFELEM ] = 0; /* subroutine argument default value */ \ opmask[OP_CALLER ] = 0; /* caller */ \ opmask[OP_WARN ] = 0; /* warn */ \ opmask[OP_DIE ] = 0; /* die */ \ opmask[OP_LINESEQ ] = 0; /* line sequence */ \ opmask[OP_NEXTSTATE ] = 0; /* next statement */ \ opmask[OP_UNSTACK ] = 0; /* iteration finalizer */ \ opmask[OP_ENTER ] = 0; /* block entry */ \ opmask[OP_LEAVE ] = 0; /* block exit */ \ opmask[OP_SCOPE ] = 0; /* block */ \ opmask[OP_ENTERITER ] = 0; /* foreach loop entry */ \ opmask[OP_ITER ] = 0; /* foreach loop iterator */ \ opmask[OP_ENTERLOOP ] = 0; /* loop entry */ \ opmask[OP_LEAVELOOP ] = 0; /* loop exit */ \ opmask[OP_RETURN ] = 0; /* return */ \ opmask[OP_LAST ] = 0; /* last */ \ opmask[OP_NEXT ] = 0; /* next */ \ opmask[OP_REDO ] = 0; /* redo */ \ opmask[OP_GOTO ] = 0; /* goto */ \ opmask[OP_METHOD_NAMED] = 0; /* method with known name */ \ opmask[OP_METHOD_SUPER] = 0; /* super with known name */ \ opmask[OP_METHOD_REDIR] = 0; /* redirect method with known name */ \ opmask[OP_METHOD_REDIR_SUPER] = 0; /* redirect super method with known name */ \ opmask[OP_ENTERGIVEN ] = 0; /* given() */ \ opmask[OP_LEAVEGIVEN ] = 0; /* leave given block */ \ opmask[OP_ENTERWHEN ] = 0; /* when() */ \ opmask[OP_LEAVEWHEN ] = 0; /* leave when block */ \ opmask[OP_BREAK ] = 0; /* break */ \ opmask[OP_CONTINUE ] = 0; /* continue */ \ opmask[OP_PIPE_OP ] = 0; /* pipe */ \ opmask[OP_TIE ] = 0; /* tie */ \ opmask[OP_UNTIE ] = 0; /* untie */ \ opmask[OP_DBMCLOSE ] = 0; /* dbmclose */ \ opmask[OP_SSELECT ] = 0; /* select system call */ \ opmask[OP_SELECT ] = 0; /* select */ \ opmask[OP_PRTF ] = 0; /* printf */ \ opmask[OP_PRINT ] = 0; /* print */ \ opmask[OP_SOCKPAIR ] = 0; /* socketpair */ \ opmask[OP_GETPPID ] = 0; /* getppid */ \ opmask[OP_GETPGRP ] = 0; /* getpgrp */ \ opmask[OP_GETPRIORITY ] = 0; /* getpriority */ \ opmask[OP_TIME ] = 0; /* time */ \ opmask[OP_LOCALTIME ] = 0; /* localtime */ \ opmask[OP_GMTIME ] = 0; /* gmtime */ \ opmask[OP_REQUIRE ] = 0; /* require */ \ opmask[OP_DOFILE ] = 0; /* do "file" */ \ opmask[OP_ENTEREVAL ] = 0; /* eval "string" */ \ opmask[OP_LEAVEEVAL ] = 0; /* eval "string" exit */ \ opmask[OP_ENTERTRY ] = 0; /* eval {block} */ \ opmask[OP_LEAVETRY ] = 0; /* eval {block} exit */ \ opmask[OP_LOCK ] = 0; /* lock */ \ opmask[OP_ONCE ] = 0; /* once */ \ opmask[OP_COREARGS ] = 0; /* CORE:: subroutine */ \ opmask[OP_AVHVSWITCH ] = 0; /* Array/hash switch */ \ opmask[OP_FC ] = 0; /* fc */ \ opmask[OP_PADCV ] = 0; /* private subroutine */ \ opmask[OP_INTROCV ] = 0; /* private subroutine */ \ opmask[OP_CLONECV ] = 0; /* private subroutine */ \ opmask[OP_PADRANGE ] = 0; /* list of private variables */ \ opmask[OP_REFASSIGN ] = 0; /* lvalue ref assignment */ \ opmask[OP_LVREF ] = 0; /* lvalue ref assignment */ \ opmask[OP_LVREFSLICE ] = 0; /* lvalue ref assignment */ \ opmask[OP_LVAVREF ] = 0; /* lvalue array reference */ \ opmask[OP_ANONCONST ] = 0; /* anonymous constant */ \ /* end */
perlchunks.h (text/x-chdr, 3.1K) download /* * DO NOT EDIT - THIS FILE IS AUTOGENERATED - CHANGES WILL BE LOST * Written by ./text2macro.pl from plc_perlboot.pl plc_trusted.pl */ #define PLC_PERLBOOT \ "use strict;\n" \ "use 5.008001;\n" \ "use vars qw(%_SHARED $_TD);\n" \ "PostgreSQL::InServer::Util::bootstrap();\n" \ "sub ::is_array_ref\n" \ "{\n" \ " return ref($_[0]) =~ m/^(?:PostgreSQL::InServer::)?ARRAY$/;\n" \ "}\n" \ "sub ::encode_array_literal\n" \ "{\n" \ " my ($arg, $delim) = @_;\n" \ " return $arg unless (::is_array_ref($arg));\n" \ " $delim = ', ' unless defined $delim;\n" \ " my $res = '';\n" \ " foreach my $elem (@$arg)\n" \ " {\n" \ " $res .= $delim if length $res;\n" \ " if (ref $elem)\n" \ " {\n" \ " $res .= ::encode_array_literal($elem, $delim);\n" \ " }\n" \ " elsif (defined $elem)\n" \ " {\n" \ " (my $str = $elem) =~ s/([\"\\\\])/\\\\$1/g;\n" \ " $res .= qq(\"$str\");\n" \ " }\n" \ " else\n" \ " {\n" \ " $res .= 'NULL';\n" \ " }\n" \ " }\n" \ " return qq({$res});\n" \ "}\n" \ "sub ::encode_array_constructor\n" \ "{\n" \ " my $arg = shift;\n" \ " return ::quote_nullable($arg) unless ::is_array_ref($arg);\n" \ " my $res = join \", \",\n" \ " map { (ref $_) ? ::encode_array_constructor($_) : ::quote_nullable($_) }\n" \ " @$arg;\n" \ " return \"ARRAY[$res]\";\n" \ "}\n" \ "{\n" \ " package PostgreSQL::InServer\n" \ " ; ## no critic (RequireFilenameMatchesPackage);\n" \ " use strict;\n" \ " use warnings;\n" \ " sub plperl_warn\n" \ " {\n" \ " (my $msg = shift) =~ s/\\(eval \\d+\\) //g;\n" \ " chomp $msg;\n" \ " &::elog(&::WARNING, $msg);\n" \ " }\n" \ " $SIG{__WARN__} = \\&plperl_warn;\n" \ " sub plperl_die\n" \ " {\n" \ " (my $msg = shift) =~ s/\\(eval \\d+\\) //g;\n" \ " die $msg;\n" \ " }\n" \ " $SIG{__DIE__} = \\&plperl_die;\n" \ " sub mkfuncsrc\n" \ " {\n" \ " my ($name, $imports, $prolog, $src) = @_;\n" \ " my $BEGIN = join \"\\n\", map {\n" \ " my $names = $imports->{$_} || [];\n" \ " \"$_->import(qw(@$names));\"\n" \ " } sort keys %$imports;\n" \ " $BEGIN &&= \"BEGIN { $BEGIN }\";\n" \ " return qq[ package main; sub { $BEGIN $prolog $src } ];\n" \ " }\n" \ " sub mkfunc\n" \ " {\n" \ " ## no critic (ProhibitNoStrict, ProhibitStringyEval);\n" \ " no strict; # default to no strict for the eval\n" \ " no warnings; # default to no warnings for the eval\n" \ " my $ret = eval(mkfuncsrc(@_));\n" \ " $@ =~ s/\\(eval \\d+\\) //g if $@;\n" \ " return $ret;\n" \ " ## use critic\n" \ " }\n" \ " 1;\n" \ "}\n" \ "{\n" \ " package PostgreSQL::InServer::ARRAY;\n" \ " use strict;\n" \ " use warnings;\n" \ " use overload\n" \ " '\"\"' => \\&to_str,\n" \ " '@{}' => \\&to_arr;\n" \ " sub to_str\n" \ " {\n" \ " my $self = shift;\n" \ " return ::encode_typed_literal($self->{'array'}, $self->{'typeoid'});\n" \ " }\n" \ " sub to_arr\n" \ " {\n" \ " return shift->{'array'};\n" \ " }\n" \ " 1;\n" \ "}\n" \ "" #define PLC_TRUSTED \ "package PostgreSQL::InServer::safe\n" \ " ; ## no critic (RequireFilenameMatchesPackage);\n" \ "require strict;\n" \ "require Carp;\n" \ "require Carp::Heavy;\n" \ "require warnings;\n" \ "require feature if $] >= 5.010000;\n" \ "" /* end */
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
@ 2017-07-31 13:39               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-07-31 13:39 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

Christoph Berg <myon@debian.org> writes:
>>> The only interesting line in log/postmaster.log is a log_line_prefix-less
>>> Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)

Can we see the Perl-related output from configure, particularly the new
lines about CFLAGS?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-07-31 16:45                 ` Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Christoph Berg @ 2017-07-31 16:45 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

Re: Tom Lane 2017-07-31 <30582.1501508356@sss.pgh.pa.us>
> Christoph Berg <myon@debian.org> writes:
> >>> The only interesting line in log/postmaster.log is a log_line_prefix-less
> >>> Util.c: loadable library and perl binaries are mismatched (got handshake key 0xd500080, needed 0xd600080)
> 
> Can we see the Perl-related output from configure, particularly the new
> lines about CFLAGS?

$ ./configure --with-perl

checking whether to build Perl modules... yes

checking for perl... /usr/bin/perl
configure: using perl 5.26.0
checking for Perl archlibexp... /usr/lib/x86_64-kfreebsd-gnu/perl/5.26
checking for Perl privlibexp... /usr/share/perl/5.26
checking for Perl useshrplib... true
checking for CFLAGS recommended by Perl... -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
checking for CFLAGS to compile embedded Perl... -DDEBIAN
checking for flags to link embedded Perl...   -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lc -lcrypt

checking for perl.h... yes
checking for libperl... yes

Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
@ 2017-08-08 12:37                   ` Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-14 16:51                     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  0 siblings, 2 replies; 94+ messages in thread

From: Sandeep Thakkar @ 2017-08-08 12:37 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

Hi

An update from beta3 build: We are no longer seeing this issue (handshake
failure) on Windows 64bit, but on Windows 32bit it still persists.

On Mon, Jul 31, 2017 at 10:15 PM, Christoph Berg <myon@debian.org> wrote:

> Re: Tom Lane 2017-07-31 <30582.1501508356@sss.pgh.pa.us>
> > Christoph Berg <myon@debian.org> writes:
> > >>> The only interesting line in log/postmaster.log is a
> log_line_prefix-less
> > >>> Util.c: loadable library and perl binaries are mismatched (got
> handshake key 0xd500080, needed 0xd600080)
> >
> > Can we see the Perl-related output from configure, particularly the new
> > lines about CFLAGS?
>
> $ ./configure --with-perl
>
> checking whether to build Perl modules... yes
>
> checking for perl... /usr/bin/perl
> configure: using perl 5.26.0
> checking for Perl archlibexp... /usr/lib/x86_64-kfreebsd-gnu/perl/5.26
> checking for Perl privlibexp... /usr/share/perl/5.26
> checking for Perl useshrplib... true
> checking for CFLAGS recommended by Perl... -D_REENTRANT -D_GNU_SOURCE
> -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> checking for CFLAGS to compile embedded Perl... -DDEBIAN
> checking for flags to link embedded Perl...   -fstack-protector-strong
> -L/usr/local/lib  -L/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -lperl
> -ldl -lm -lpthread -lc -lcrypt
>
> checking for perl.h... yes
> checking for libperl... yes
>
> Christoph
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>



-- 
Sandeep Thakkar
EDB

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
@ 2017-08-08 14:49                     ` Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Robert Haas @ 2017-08-08 14:49 UTC (permalink / raw)
  To: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; +Cc: Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

On Tue, Aug 8, 2017 at 8:37 AM, Sandeep Thakkar
<sandeep.thakkar@enterprisedb.com> wrote:
> An update from beta3 build: We are no longer seeing this issue (handshake
> failure) on Windows 64bit, but on Windows 32bit it still persists.

Hmm, maybe you should've reported it sooner, so we could've tried to
fix this before beta3 went out.

What was the exact message you saw, including the hex values?

Is the Perl you were building against for plperl the same Perl that
was being used for the build itself?

Do you have the portion of the build log where src/pl/plperl was being built?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-08-08 16:15                       ` Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Sandeep Thakkar @ 2017-08-08 16:15 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

On Tue, Aug 8, 2017 at 8:19 PM, Robert Haas <robertmhaas@gmail.com> wrote:

> On Tue, Aug 8, 2017 at 8:37 AM, Sandeep Thakkar
> <sandeep.thakkar@enterprisedb.com> wrote:
> > An update from beta3 build: We are no longer seeing this issue (handshake
> > failure) on Windows 64bit, but on Windows 32bit it still persists.
>
> Hmm, maybe you should've reported it sooner, so we could've tried to
> fix this before beta3 went out.
>
> Yes, that would have been better. The patch was tested only on Windows
64bit and we never thought that it won't work on 32bit.


> What was the exact message you saw, including the hex values?
>
> Attach is the screenshot of the contents of the postmaster log that was
sent to me by one of my team members who was testing this.


> Is the Perl you were building against for plperl the same Perl that
> was being used for the build itself?
>
> Yes.


> Do you have the portion of the build log where src/pl/plperl was being
> built?
>
> I copied and pasted that portion of the build log into file build.log
(attached) for Windows 32bit and Windows 64bit.

Thanks.

> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
Sandeep Thakkar
EDB

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

handshare_win32.png (image/png, 283.9K) download view image
build.log (application/octet-stream, 30.0K) download ^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
@ 2017-08-09 20:25                         ` Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Robert Haas @ 2017-08-09 20:25 UTC (permalink / raw)
  To: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; +Cc: Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

On Tue, Aug 8, 2017 at 12:15 PM, Sandeep Thakkar
<sandeep.thakkar@enterprisedb.com> wrote:
> I copied and pasted that portion of the build log into file build.log
> (attached) for Windows 32bit and Windows 64bit.

Can you also share the output of 'perl -V' on each system?

Comparing the 32-bit log and the 64-bit log, I see the following differences:

32-bit has extra options /IC:\pgBuild32\uuid\include /Oy- /analyze- /D
_USE_32BIT_TIME_T
64-bit has extra options /D WIN64 /D CONSERVATIVE /D USE_SITECUSTOMIZE
Both builds have several copies of /IC:\pgBuild32\include or
/IC:\pgBuild64\include, but the 64-bit build has an extra one

(I wrote that command on Linux, might need different quoting to work
on Windows.)

I'm suspicious about _USE_32BIT_TIME_T.  The contents of a
PerlInterpreter are defined in Perl's intrpvar.h, and one of those
lines is:

PERLVAR(I, basetime,    Time_t)         /* $^T */

Now, Time_t is defined as time_t elsewhere in the Perl headers, so if
the plperl build and the Perl interpreter build had different ideas
about whether that flag was set, the interpreter sizes would be
different.  Unfortunately for this theory, if I'm interpreting the
screenshot you posted correctly, the sizes are different by exactly 16
bytes, and I can't see how a difference in the size of time_t could
account for more than 8 bytes (4 bytes of actual size change + 4 bytes
of padding).

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-08-10 12:30                           ` Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Ashutosh Sharma @ 2017-08-10 12:30 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers

On Thu, Aug 10, 2017 at 1:55 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Tue, Aug 8, 2017 at 12:15 PM, Sandeep Thakkar
> <sandeep.thakkar@enterprisedb.com> wrote:
>> I copied and pasted that portion of the build log into file build.log
>> (attached) for Windows 32bit and Windows 64bit.
>
> Can you also share the output of 'perl -V' on each system?
>
> Comparing the 32-bit log and the 64-bit log, I see the following differences:
>
> 32-bit has extra options /IC:\pgBuild32\uuid\include /Oy- /analyze- /D
> _USE_32BIT_TIME_T
> 64-bit has extra options /D WIN64 /D CONSERVATIVE /D USE_SITECUSTOMIZE
> Both builds have several copies of /IC:\pgBuild32\include or
> /IC:\pgBuild64\include, but the 64-bit build has an extra one
>
> (I wrote that command on Linux, might need different quoting to work
> on Windows.)
>
> I'm suspicious about _USE_32BIT_TIME_T.  The contents of a
> PerlInterpreter are defined in Perl's intrpvar.h, and one of those
> lines is:
>
> PERLVAR(I, basetime,    Time_t)         /* $^T */
>
> Now, Time_t is defined as time_t elsewhere in the Perl headers, so if
> the plperl build and the Perl interpreter build had different ideas
> about whether that flag was set, the interpreter sizes would be
> different.  Unfortunately for this theory, if I'm interpreting the
> screenshot you posted correctly, the sizes are different by exactly 16
> bytes, and I can't see how a difference in the size of time_t could
> account for more than 8 bytes (4 bytes of actual size change + 4 bytes
> of padding).
>

Okay. I too had a look into this issue and my findings are as follows,

The size of PerlInterpreter structure on plperl and perl module are
not the same. The size of PerlInterpreter on plperl is 2744 bytes
whereas on perl it is 2760 bytes i.e. there is the difference of 16
bytes and therefore the handshaking key generated in the two modules
are not the same resulting in a binary mismatch error. To analyse this
problem, I generated the preprocessed output of header file 'perl.h'
on plperl and perl modules and then filtered the contents of "struct
interpreter" from the preprocessed output files and  compared them
using some diff tool. The diff report is attached with this email.

As per the diff report, incase of  plperl module,  the structure
Stat_t is getting mapped to "_stat32i64" whereas incase of perl
module, the same structure is getting mapped to "_stat64" and this is
happening for couple of variables (statbuf & statcache) in intrpvar.h
file. However, if the preprocessor option '_USE_32BIT_TIME_T' is
explicitly passed to the VC compiler when compiling perl source, there
is no diff observed as in both the cases, 'Stat_t ' is gets mapped to
"stat32i64". So, now the question is, why ''_USE_32BIT_TIME_T'  flag
is not implicitly defined when compiling perl source on 32 bit
platform but for postgresql/plperl build it is being defined
implicitly on 32bit platform. I just got few hints from the Makefile,
in perl source code, where is has been mentioned that  the modern
Visual C compiler (VC++ 8.0 onwards) changes time_t from 32-bit to
64-bit, even in 32-bit mode hence, ''_USE_32BIT_TIME_T'   is net being
added to $Config{ccflags}. Here, is what i could see in
GNUMakefile/Makefile.mk in perl source code.

# In VS 2005 (VC++ 8.0) Microsoft changes time_t from 32-bit to
# 64-bit, even in 32-bit mode.  It also provides the _USE_32BIT_TIME_T
# preprocessor option to revert back to the old functionality for
# backward compatibility.  We define this symbol here for older 32-bit
# compilers only (which aren't using it at all) for the sole purpose
# of getting it into $Config{ccflags}.  That way if someone builds
# Perl itself with e.g. VC6 but later installs an XS module using VC8
# the time_t types will still be compatible.

ifeq ($(WIN64),undef)
ifeq ((PREMSVC80),define)
BUILDOPT += -D_USE_32BIT_TIME_T
endif
endif

So, the question is should we allow the preprocessor option
'_USE_32BIT_TIME_T' to be defined implicitly or not in postgresql
provided we are using Visual C compiler version > 8.0. I think this
should make plperl compatible with perl binaries.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

perl_plperl_interpreter_struct_diff.html (text/html, 3.3K) download <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style> .AlignLeft { text-align: left; } .AlignCenter { text-align: center; } .AlignRight { text-align: right; } body { font-family: sans-serif; font-size: 11pt; } td { vertical-align: top; padding-left: 4px; padding-right: 4px; } tr.SectionGap td { font-size: 4px; border-left: none; border-top: none; border-bottom: 1px solid Black; border-right: 1px solid Black; } tr.SectionAll td { border-left: none; border-top: none; border-bottom: 1px solid Black; border-right: 1px solid Black; } tr.SectionBegin td { border-left: none; border-top: none; border-right: 1px solid Black; } tr.SectionEnd td { border-left: none; border-top: none; border-bottom: 1px solid Black; border-right: 1px solid Black; } tr.SectionMiddle td { border-left: none; border-top: none; border-right: 1px solid Black; } tr.SubsectionAll td { border-left: none; border-top: none; border-bottom: 1px solid Gray; border-right: 1px solid Black; } tr.SubsectionEnd td { border-left: none; border-top: none; border-bottom: 1px solid Gray; border-right: 1px solid Black; } table.fc { border-top: 1px solid Black; border-left: 1px solid Black; width: 100%; font-family: monospace; font-size: 10pt; } td.TextItemInsigAdd { color: #000000; background-color: #EFEFFF; } td.TextItemInsigDel { color: #000000; background-color: #EFEFFF; text-decoration: line-through; } td.TextItemInsigDiffMod { color: #000000; background-color: #EFEFFF; } td.TextItemInsigLeftMod { color: #000000; background-color: #EFEFFF; } td.TextItemInsigRightMod { color: #000000; background-color: #EFEFFF; } td.TextItemNum { color: #827357; background-color: #F2F2F2; } td.TextItemSame { color: #000000; background-color: #FFFFFF; } td.TextItemSigAdd { color: #000000; background-color: #FFE3E3; } td.TextItemSigDel { color: #000000; background-color: #FFE3E3; text-decoration: line-through; } td.TextItemSigDiffMod { color: #000000; background-color: #FFE3E3; } td.TextItemSigLeftMod { color: #000000; background-color: #FFE3E3; } td.TextItemSigRightMod { color: #000000; background-color: #FFE3E3; } .TextSegInsigDiff { color: #0000FF; } .TextSegReplacedDiff { color: #0000FF; font-style: italic; } .TextSegSigDiff { color: #FF0000; } </style> <title>Text Compare</title> </head> <body> Text Compare<br/> Produced: 8/10/2017 1:44:37 PM<br/> &nbsp; &nbsp; <br/> Mode:&nbsp; Differences &nbsp; <br/> Left file: C:\Users\ashu\perl-5.24.1\perl_interpreter.out &nbsp; <br/> Right file: C:\Users\ashu\git-clone-postgresql\postgresql\plper_intrpreter.out &nbsp; <br/> <table class="fc" cellspacing="0" cellpadding="0"> <tr class="SectionBegin"> <td class="TextItemSigDiffMod">struct _stat64 Istatbuf;</td> <td class="AlignCenter">&lt;&gt;</td> <td class="TextItemSigDiffMod">struct _stat<span class="TextSegSigDiff">32i</span>64 Istatbuf;</td> </tr> <tr class="SectionEnd"> <td class="TextItemSigDiffMod">struct _stat64 Istatcache;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;</td> <td class="AlignCenter">&nbsp;</td> <td class="TextItemSigDiffMod">struct _stat<span class="TextSegSigDiff">32i</span>64 Istatcache;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td> </tr> </table> <br/> </body> </html>
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
@ 2017-08-10 14:17                             ` Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Robert Haas @ 2017-08-10 14:17 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers

On Thu, Aug 10, 2017 at 8:30 AM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> So, the question is should we allow the preprocessor option
> '_USE_32BIT_TIME_T' to be defined implicitly or not in postgresql
> provided we are using Visual C compiler version > 8.0. I think this
> should make plperl compatible with perl binaries.

We've got this code in MSBuildProject.pm and VCBuildProject.pm:

        # We have to use this flag on 32 bit targets because the 32bit perls
        # are built with it and sometimes crash if we don't.
        my $use_32bit_time_t =
          $self->{platform} eq 'Win32' ? '_USE_32BIT_TIME_T;' : '';

Based on the discussion upthread, I think we now know that this was
not really the right approach.  IIUC, a given 32-bit Perl might've
been built with _USE_32BIT_TIME_T, or not; in fact, given the comments
you found on the Perl side, it's more than likely that most modern
32-bit Perls are NOT build with this option.  What we actually need to
do here is use _USE_32BIT_TIME_T if and only if it was used when Perl
was built (otherwise we'll end up with a different interpreter size).

The trouble with that is that _USE_32BIT_TIME_T also affects how
PostgreSQL code compiles.  Apparently, given that according to Perl
this was changed by Microsoft in 2005, we're forcing the Microsoft
compilers into a non-default backward compatibility mode by defining
this symbol, and that affects how our entire code base compiles -- and
it just so happens that the result is compatible with older Perl
builds that used _USE_32BIT_TIME_T and not compatible with newer ones
that don't.

Maybe we need to make _USE_32BIT_TIME_T a compile-time configuration
option on Windows, and then cross-check that our setting is compatible
with Perl's setting.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
@ 2017-08-10 14:36                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:11                                 ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 15:22                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:23                                 ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 4 replies; 94+ messages in thread

From: Tom Lane @ 2017-08-10 14:36 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Aug 10, 2017 at 8:30 AM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
>> So, the question is should we allow the preprocessor option
>> '_USE_32BIT_TIME_T' to be defined implicitly or not in postgresql
>> provided we are using Visual C compiler version > 8.0. I think this
>> should make plperl compatible with perl binaries.

> We've got this code in MSBuildProject.pm and VCBuildProject.pm:

>         # We have to use this flag on 32 bit targets because the 32bit perls
>         # are built with it and sometimes crash if we don't.
>         my $use_32bit_time_t =
>           $self->{platform} eq 'Win32' ? '_USE_32BIT_TIME_T;' : '';

> Based on the discussion upthread, I think we now know that this was
> not really the right approach.

Yeah ... however, if that's there, then there's something wrong with
Ashutosh's explanation, because that means we *are* building with
_USE_32BIT_TIME_T in 32-bit builds.  It's just getting there in a
roundabout way.  (Or, alternatively, this code is somehow not doing
anything at all.)

> The trouble with that is that _USE_32BIT_TIME_T also affects how
> PostgreSQL code compiles.

Really?  We try to avoid touching "time_t" at all in most of the code.
I bet that we could drop the above-cited code, and compile only plperl
with _USE_32BIT_TIME_T, taken (if present) from the Perl flags, and
it'd be fine.  At least, that's my first instinct for what to try.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-10 15:11                                 ` Robert Haas <robertmhaas@gmail.com>
  3 siblings, 0 replies; 94+ messages in thread

From: Robert Haas @ 2017-08-10 15:11 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

On Thu, Aug 10, 2017 at 10:36 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Yeah ... however, if that's there, then there's something wrong with
> Ashutosh's explanation, because that means we *are* building with
> _USE_32BIT_TIME_T in 32-bit builds.  It's just getting there in a
> roundabout way.  (Or, alternatively, this code is somehow not doing
> anything at all.)

I don't follow.

>> The trouble with that is that _USE_32BIT_TIME_T also affects how
>> PostgreSQL code compiles.
>
> Really?  We try to avoid touching "time_t" at all in most of the code.
> I bet that we could drop the above-cited code, and compile only plperl
> with _USE_32BIT_TIME_T, taken (if present) from the Perl flags, and
> it'd be fine.  At least, that's my first instinct for what to try.

Oh.  Well, if that's an OK thing to do, then sure, wfm.  I guess we've
got pg_time_t plastered all over the backend but that's not actually
time_t under the hood, so it's fine.  I do see time_t being used in
frontend code, but that won't matter for this.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-10 15:22                                 ` Tom Lane <tgl@sss.pgh.pa.us>
  3 siblings, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-08-10 15:22 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Aug 10, 2017 at 10:36 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah ... however, if that's there, then there's something wrong with
>> Ashutosh's explanation, because that means we *are* building with
>> _USE_32BIT_TIME_T in 32-bit builds.  It's just getting there in a
>> roundabout way.  (Or, alternatively, this code is somehow not doing
>> anything at all.)

> I don't follow.

The stanzas you pointed to in the MSVC build scripts should mean that
a 32-bit PG build is using _USE_32BIT_TIME_T, no?  And Ashutosh stated
that he saw _USE_32BIT_TIME_T in "perl -V" output.  So how are they
not ending up compatible?

Now, if that statement was wrong and his 32-bit Perl actually *isn't*
built with _USE_32BIT_TIME_T, then this is clearly what's causing the
problem.

>> Really?  We try to avoid touching "time_t" at all in most of the code.
>> I bet that we could drop the above-cited code, and compile only plperl
>> with _USE_32BIT_TIME_T, taken (if present) from the Perl flags, and
>> it'd be fine.  At least, that's my first instinct for what to try.

> Oh.  Well, if that's an OK thing to do, then sure, wfm.  I guess we've
> got pg_time_t plastered all over the backend but that's not actually
> time_t under the hood, so it's fine.  I do see time_t being used in
> frontend code, but that won't matter for this.

Yeah.  I think this should work as long as plperl itself doesn't use
time_t, or at least doesn't exchange time_t with any other part of the
system, and since we don't use that type in any common APIs that seems
like an OK assumption.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-10 15:23                                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
  3 siblings, 0 replies; 94+ messages in thread

From: Ashutosh Sharma @ 2017-08-10 15:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

On Thu, Aug 10, 2017 at 8:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Thu, Aug 10, 2017 at 8:30 AM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
>>> So, the question is should we allow the preprocessor option
>>> '_USE_32BIT_TIME_T' to be defined implicitly or not in postgresql
>>> provided we are using Visual C compiler version > 8.0. I think this
>>> should make plperl compatible with perl binaries.
>
>> We've got this code in MSBuildProject.pm and VCBuildProject.pm:
>
>>         # We have to use this flag on 32 bit targets because the 32bit perls
>>         # are built with it and sometimes crash if we don't.
>>         my $use_32bit_time_t =
>>           $self->{platform} eq 'Win32' ? '_USE_32BIT_TIME_T;' : '';
>
>> Based on the discussion upthread, I think we now know that this was
>> not really the right approach.
>
> Yeah ... however, if that's there, then there's something wrong with
> Ashutosh's explanation, because that means we *are* building with
> _USE_32BIT_TIME_T in 32-bit builds.  It's just getting there in a
> roundabout way.  (Or, alternatively, this code is somehow not doing
> anything at all.)

I am extremely sorry if i have communicated the things wrongly, what i
meant was we are always considering _USE_32BIT_TIME_T flag to build
plperl module on Windows 32-bit platform but unfortunately that is not
being considered/defined in perl code in case we use VC++ compiler
version greater than 8.0. and that's the reason for the binary
mismatch error on 32 bit platform.

Here, is what has been mentioned in 'win32/GNUMakefile' in perl source
for version 5.24.1

# In VS 2005 (VC++ 8.0) Microsoft changes time_t from 32-bit to
# 64-bit, even in 32-bit mode.  It also provides the _USE_32BIT_TIME_T
# preprocessor option to revert back to the old functionality for
# backward compatibility.  We define this symbol here for older 32-bit
# compilers only (which aren't using it at all) for the sole purpose
# of getting it into $Config{ccflags}.  That way if someone builds
# Perl itself with e.g. VC6 but later installs an XS module using VC8
# the time_t types will still be compatible.
ifeq ($(WIN64),undef)
ifeq ((PREMSVC80),define)
BUILDOPT    += -D_USE_32BIT_TIME_T
endif
endif


>
>> The trouble with that is that _USE_32BIT_TIME_T also affects how
>> PostgreSQL code compiles.
>
> Really?  We try to avoid touching "time_t" at all in most of the code.
> I bet that we could drop the above-cited code, and compile only plperl
> with _USE_32BIT_TIME_T, taken (if present) from the Perl flags, and
> it'd be fine.  At least, that's my first instinct for what to try.
>


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-10 15:34                                 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  3 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-10 15:34 UTC (permalink / raw)
  To: Ashutosh Sharma <ashu.coek88@gmail.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> On Thu, Aug 10, 2017 at 8:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah ... however, if that's there, then there's something wrong with
>> Ashutosh's explanation, because that means we *are* building with
>> _USE_32BIT_TIME_T in 32-bit builds.  It's just getting there in a
>> roundabout way.  (Or, alternatively, this code is somehow not doing
>> anything at all.)

> I am extremely sorry if i have communicated the things wrongly, what i
> meant was we are always considering _USE_32BIT_TIME_T flag to build
> plperl module on Windows 32-bit platform but unfortunately that is not
> being considered/defined in perl code in case we use VC++ compiler
> version greater than 8.0. and that's the reason for the binary
> mismatch error on 32 bit platform.

Got it.  So in short, it seems like the attached patch ought to fix it
for MSVC builds.  (We'd also need to teach PGAC_CHECK_PERL_EMBED_CCFLAGS
to let _USE_32BIT_TIME_T through on Windows, but let's confirm the theory
first.)

			regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

32bit_time_t.patch (text/x-diff, 3.0K) download diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index d7638b4..27329f9 100644 *** a/src/tools/msvc/MSBuildProject.pm --- b/src/tools/msvc/MSBuildProject.pm *************** EOF *** 63,83 **** </PropertyGroup> EOF - # We have to use this flag on 32 bit targets because the 32bit perls - # are built with it and sometimes crash if we don't. - my $use_32bit_time_t = - $self->{platform} eq 'Win32' ? '_USE_32BIT_TIME_T;' : ''; - $self->WriteItemDefinitionGroup( $f, 'Debug', ! { defs => "_DEBUG;DEBUG=1;$use_32bit_time_t", opt => 'Disabled', strpool => 'false', runtime => 'MultiThreadedDebugDLL' }); $self->WriteItemDefinitionGroup( $f, 'Release', ! { defs => "$use_32bit_time_t", opt => 'Full', strpool => 'true', runtime => 'MultiThreadedDLL' }); --- 63,78 ---- </PropertyGroup> EOF $self->WriteItemDefinitionGroup( $f, 'Debug', ! { defs => "_DEBUG;DEBUG=1", opt => 'Disabled', strpool => 'false', runtime => 'MultiThreadedDebugDLL' }); $self->WriteItemDefinitionGroup( $f, 'Release', ! { defs => "", opt => 'Full', strpool => 'true', runtime => 'MultiThreadedDLL' }); diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index a7e3a01..940bef6 100644 *** a/src/tools/msvc/Mkvcbuild.pm --- b/src/tools/msvc/Mkvcbuild.pm *************** sub mkvcbuild *** 522,528 **** my @perl_embed_ccflags; foreach my $f (split(" ",$Config{ccflags})) { ! if ($f =~ /^-D[^_]/) { $f =~ s/\-D//; push(@perl_embed_ccflags, $f); --- 522,529 ---- my @perl_embed_ccflags; foreach my $f (split(" ",$Config{ccflags})) { ! if ($f =~ /^-D[^_]/ || ! $f =~ /^-D_USE_32BIT_TIME_T/) { $f =~ s/\-D//; push(@perl_embed_ccflags, $f); diff --git a/src/tools/msvc/VCBuildProject.pm b/src/tools/msvc/VCBuildProject.pm index a8d75d8..669ba17 100644 *** a/src/tools/msvc/VCBuildProject.pm --- b/src/tools/msvc/VCBuildProject.pm *************** sub WriteHeader *** 33,47 **** <Configurations> EOF - # We have to use this flag on 32 bit targets because the 32bit perls - # are built with it and sometimes crash if we don't. - my $use_32bit_time_t = - $self->{platform} eq 'Win32' ? '_USE_32BIT_TIME_T;' : ''; - - $self->WriteConfiguration( $f, 'Debug', ! { defs => "_DEBUG;DEBUG=1;$use_32bit_time_t", wholeopt => 0, opt => 0, strpool => 'false', --- 33,41 ---- <Configurations> EOF $self->WriteConfiguration( $f, 'Debug', ! { defs => "_DEBUG;DEBUG=1", wholeopt => 0, opt => 0, strpool => 'false', *************** EOF *** 49,55 **** $self->WriteConfiguration( $f, 'Release', ! { defs => "$use_32bit_time_t", wholeopt => 0, opt => 3, strpool => 'true', --- 43,49 ---- $self->WriteConfiguration( $f, 'Release', ! { defs => "", wholeopt => 0, opt => 3, strpool => 'true',
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-14 09:42                                   ` Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Sandeep Thakkar @ 2017-08-14 09:42 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

Hi

On Thu, Aug 10, 2017 at 9:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> > On Thu, Aug 10, 2017 at 8:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Yeah ... however, if that's there, then there's something wrong with
> >> Ashutosh's explanation, because that means we *are* building with
> >> _USE_32BIT_TIME_T in 32-bit builds.  It's just getting there in a
> >> roundabout way.  (Or, alternatively, this code is somehow not doing
> >> anything at all.)
>
> > I am extremely sorry if i have communicated the things wrongly, what i
> > meant was we are always considering _USE_32BIT_TIME_T flag to build
> > plperl module on Windows 32-bit platform but unfortunately that is not
> > being considered/defined in perl code in case we use VC++ compiler
> > version greater than 8.0. and that's the reason for the binary
> > mismatch error on 32 bit platform.
>
> Got it.  So in short, it seems like the attached patch ought to fix it
> for MSVC builds.  (We'd also need to teach PGAC_CHECK_PERL_EMBED_CCFLAGS
> to let _USE_32BIT_TIME_T through on Windows, but let's confirm the theory
> first.)
>
> We built the sources with this patch and were able to create the plperl
extension on Windows 32bit and 64bit.


>                         regards, tom lane
>
>


-- 
Sandeep Thakkar
EDB

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
@ 2017-08-14 13:42                                     ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-14 13:42 UTC (permalink / raw)
  To: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; +Cc: Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; Christoph Berg <myon@debian.org>; pgsql-hackers

Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> writes:
> On Thu, Aug 10, 2017 at 9:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Got it.  So in short, it seems like the attached patch ought to fix it
>> for MSVC builds.  (We'd also need to teach PGAC_CHECK_PERL_EMBED_CCFLAGS
>> to let _USE_32BIT_TIME_T through on Windows, but let's confirm the theory
>> first.)

> We built the sources with this patch and were able to create the plperl
> extension on Windows 32bit and 64bit.

Excellent, thanks for testing.  I'll finish up the configure-script part
and push this shortly.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-14 20:37                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-14 20:37 UTC (permalink / raw)
  To: Dave Page <dpage@postgresql.org>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

I wrote:
> Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> writes:
>> We built the sources with this patch and were able to create the plperl
>> extension on Windows 32bit and 64bit.

> Excellent, thanks for testing.  I'll finish up the configure-script part
> and push this shortly.

So the early returns from the buildfarm are that this broke baiji,
although a couple of other Windows critters seem to be OK with it.

This presumably means that baiji's version of perl was built with
_USE_32BIT_TIME_T, but $Config{ccflags} isn't admitting to that.
I wonder what Perl version that is exactly, and what it reports for
$Config{ccflags}, and whether there is some other place that we
ought to be looking for the info.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-17 08:12                                         ` Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Dave Page @ 2017-08-17 08:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Mon, Aug 14, 2017 at 9:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> I wrote:
> > Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> writes:
> >> We built the sources with this patch and were able to create the plperl
> >> extension on Windows 32bit and 64bit.
>
> > Excellent, thanks for testing.  I'll finish up the configure-script part
> > and push this shortly.
>
> So the early returns from the buildfarm are that this broke baiji,
> although a couple of other Windows critters seem to be OK with it.
>
> This presumably means that baiji's version of perl was built with
> _USE_32BIT_TIME_T, but $Config{ccflags} isn't admitting to that.
> I wonder what Perl version that is exactly, and what it reports for
> $Config{ccflags}, and whether there is some other place that we
> ought to be looking for the info.
>

It's ActiveState Perl 5.8.8. Printing $Config{ccflags} doesn't seem to do
anything, but perl -V output is below:

C:\Program Files\Microsoft Visual Studio 8\VC>c:\perl\bin\perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=de
fine
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -
DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_
CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='12.00.8804', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksi
ze=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
 -libpath:"C:
\Perl\lib\CORE"  -machine:x86'
    libpth=\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
 comdlg32
.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib
ws2_
32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
 comd
lg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib
ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -
libpath:"C:\Perl\lib\CORE"  -machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                        PERL_IMPLICIT_SYS PERL_MALLOC_WRAP
                        PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_SITECUSTOMIZE
  Locally applied patches:
        ActivePerl Build 820 [274739]
        Iin_load_module moved for compatibility with build 806
        PerlEx support in CGI::Carp
        Less verbose ExtUtils::Install and Pod::Find
        Patch for CAN-2005-0448 from Debian with modifications
        Rearrange @INC so that 'site' is searched before 'perl'
        Partly reverted 24733 to preserve binary compatibility
        29930 win32.c typo in #define MULTIPLICITY
        29868 win32_async_check() can still loop indefinitely
        29690,29732 ANSIfy the PATH environment variable on Windows
        29689 Add error handling to win32_ansipath
        29675 Use short pathnames in $^X and @INC
        29607,29676 allow blib.pm to be used for testing Win32 module
        29605 Implement killpg() for MSWin32
        29598 cwd() to return the short pathname
        29597 let readdir() return the alternate filename
        29590 Don't destroy the Unicode system environment on Perl startup
        29528 get ext/Win32/Win32.xs to compile on cygwin
        29509,29510,29511 Move Win32::* functions into Win32 module
        29483 Move Win32 from win32/ext/Win32 to ext/Win32
        29481 Makefile.PL changes to compile Win32.xs using cygwin
        28671 Define PERL_NO_DEV_RANDOM on Windows
        28376 Add error checks after execing PL_cshname or PL_sh_path
        28305 Pod::Html should not convert "foo" into ``foo''
        27833 Change anchor generation in Pod::Html for '=item item 2'
        27832,27847 fix Pod::Html::depod() for multi-line strings
        27719 Document the functions htmlify() and anchorify() in Pod::Html
        27619 Bug in Term::ReadKey being triggered by a bug in
Term::ReadLine
        27549 Move DynaLoader.o into libperl.so
        27528 win32_pclose() error exit doesn't unlock mutex
        27527 win32_async_check() can loop indefinitely
        27515 ignore directories when searching @INC
        27359 Fix -d:Foo=bar syntax
        27210 Fix quote typo in c2ph
        27203 Allow compiling swigged C++ code
        27200 Make stat() on Windows handle trailing slashes correctly
        27133 Initialise lastparen in the regexp structure
        27061 L<PerlIO> and Pod::Html
        27034 Avoid "Prototype mismatch" warnings with autouse
        26970 Make Passive mode the default for Net::FTP
        26921 Avoid getprotobyname/number calls in IO::Socket::INET
        26897,26903 Make common IPPROTO_* constants always available
        26670 Make '-s' on the shebang line parse -foo=bar switches
        26637 Make Borland and MinGW happy with change 26379
        26536 INSTALLSCRIPT versus INSTALLDIRS
        26379 Fix alarm() for Windows 2003
        26087 Storable 0.1 compatibility
        25861 IO::File performace issue
        25084 long groups entry could cause memory exhaustion
        24699 ICMP_UNREACHABLE handling in Net::Ping
  Built under MSWin32
  Compiled at Jan 23 2007 15:57:46
  @INC:
    c:/perl/site/lib
    c:/perl/lib
    .

C:\Program Files\Microsoft Visual Studio 8\VC>

-- 
Dave Page
PostgreSQL Core Team
http://www.postgresql.org/

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
@ 2017-08-17 13:58                                           ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-17 13:58 UTC (permalink / raw)
  To: Dave Page <dpage@postgresql.org>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

Dave Page <dpage@postgresql.org> writes:
> It's ActiveState Perl 5.8.8. Printing $Config{ccflags} doesn't seem to do
> anything, but perl -V output is below:

That's weird ... you get nothing from

perl -MConfig -e 'print $Config{ccflags}'

?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-17 14:16                                             ` Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Dave Page @ 2017-08-17 14:16 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Thu, Aug 17, 2017 at 2:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Dave Page <dpage@postgresql.org> writes:
> > It's ActiveState Perl 5.8.8. Printing $Config{ccflags} doesn't seem to do
> > anything, but perl -V output is below:
>
> That's weird ... you get nothing from
>
> perl -MConfig -e 'print $Config{ccflags}'
>

Didn't realise I needed the -MConfig bit (told you my perl-fu was weak :-)
):

C:\Perl\bin>perl -MConfig -e "print $Config{ccflags}"
-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX

-- 
Dave Page
PostgreSQL Core Team
http://www.postgresql.org/

^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
@ 2017-08-17 14:57                                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-17 14:57 UTC (permalink / raw)
  To: Dave Page <dpage@postgresql.org>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

Dave Page <dpage@postgresql.org> writes:
> Didn't realise I needed the -MConfig bit (told you my perl-fu was weak :-)
> ):

> C:\Perl\bin>perl -MConfig -e "print $Config{ccflags}"
> -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT
> -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE
> -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
> -DPERL_MSVCRT_READFIX

So it is indeed not advertising anything about _USE_32BIT_TIME_T ...
but then how do other Perl extensions work?  Strange.

I wonder whether slightly-newer versions of ActiveState Perl work.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-17 15:30                                                 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-17 15:30 UTC (permalink / raw)
  To: Dave Page <dpage@postgresql.org>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

I wrote:
> Dave Page <dpage@postgresql.org> writes:
>> C:\Perl\bin>perl -MConfig -e "print $Config{ccflags}"
>> -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT
>> -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE
>> -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
>> -DPERL_MSVCRT_READFIX

> So it is indeed not advertising anything about _USE_32BIT_TIME_T ...
> but then how do other Perl extensions work?  Strange.

So we're between a rock and a hard place here.  ActiveState Perl 5.8.8
requires us to use _USE_32BIT_TIME_T, and doesn't appear to display that
requirement in any standard way.  Newer versions of Perl require us not
to use that symbol unless they say so.

Short of declaring this version of Perl unsupported, the only answer
I can think of is to put a kluge into the MSVC build scripts along
the lines of "if it's 32-bit Windows, and the Perl version is before X,
assume we need _USE_32BIT_TIME_T even if $Config{ccflags} doesn't
say so".  It would be nice to have some hard evidence about what X
should be, but we don't know when ActiveState fixed this.  (I poked
around in their bugzilla, without success.)

In the interests of getting the buildfarm green again before I disappear
on vacation, I propose to do the above with X = 5.10.0.  Anybody
have a better idea?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-08-17 16:15                                                   ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  0 siblings, 1 reply; 94+ messages in thread

From: Tom Lane @ 2017-08-17 16:15 UTC (permalink / raw)
  To: Dave Page <dpage@postgresql.org>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

I wrote:
> Short of declaring this version of Perl unsupported, the only answer
> I can think of is to put a kluge into the MSVC build scripts along
> the lines of "if it's 32-bit Windows, and the Perl version is before X,
> assume we need _USE_32BIT_TIME_T even if $Config{ccflags} doesn't
> say so".  It would be nice to have some hard evidence about what X
> should be, but we don't know when ActiveState fixed this.  (I poked
> around in their bugzilla, without success.)

Ah-hah: it wasn't ActiveState that fixed this at all; it was upstream
Perl.  The stanza that Ashutosh found about defining _USE_32BIT_TIME_T
originated in Perl 5.13.4; older Perls simply don't provide it, no
matter how they were built.

We can now isolate the exact reason we're having trouble on baiji:
it's building Postgres with MSVC 2005, which by default will think
time_t is 64 bits, but it must be using a copy of Perl that was
built with an older Microsoft compiler that doesn't think that.
(Dave's "perl -V" output says ccversion='12.00.8804', but I don't
know how to translate that to the marketing version.)  And since it's
pre-5.13.4, Perl itself doesn't know it should advertise this fact.

So it's now looking to me like we should do the above with X = 5.13.4.
That won't be a perfect solution, but it's about the best we can
readily do.  Realistically, nobody out in the wider world is likely
to care about building current PG releases against such old Perl
versions on Windows; if we satisfy our older buildfarm critters,
it's enough for me.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-11-30 04:14                                                     ` Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-04 02:29                                                       ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Noah Misch @ 2017-11-30 04:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Thu, Aug 17, 2017 at 12:15:58PM -0400, Tom Lane wrote:
> I wrote:
> > Short of declaring this version of Perl unsupported, the only answer
> > I can think of is to put a kluge into the MSVC build scripts along
> > the lines of "if it's 32-bit Windows, and the Perl version is before X,
> > assume we need _USE_32BIT_TIME_T even if $Config{ccflags} doesn't
> > say so".  It would be nice to have some hard evidence about what X
> > should be, but we don't know when ActiveState fixed this.  (I poked
> > around in their bugzilla, without success.)
> 
> Ah-hah: it wasn't ActiveState that fixed this at all; it was upstream
> Perl.  The stanza that Ashutosh found about defining _USE_32BIT_TIME_T
> originated in Perl 5.13.4; older Perls simply don't provide it, no
> matter how they were built.
> 
> We can now isolate the exact reason we're having trouble on baiji:
> it's building Postgres with MSVC 2005, which by default will think
> time_t is 64 bits, but it must be using a copy of Perl that was
> built with an older Microsoft compiler that doesn't think that.
> (Dave's "perl -V" output says ccversion='12.00.8804', but I don't
> know how to translate that to the marketing version.)  And since it's
> pre-5.13.4, Perl itself doesn't know it should advertise this fact.
> 
> So it's now looking to me like we should do the above with X = 5.13.4.
> That won't be a perfect solution, but it's about the best we can
> readily do.  Realistically, nobody out in the wider world is likely
> to care about building current PG releases against such old Perl
> versions on Windows; if we satisfy our older buildfarm critters,
> it's enough for me.

MinGW default behavior matches "cl -D_USE_32BIT_TIME_T", and MSVC >= 2005
default behavior matches "gcc -D__MINGW_USE_VC2005_COMPAT"[1].  MinGW-built
Perl[2] does not mention _USE_32BIT_TIME_T in $Config{ccflags}, so we
typically must add _USE_32BIT_TIME_T when using MSVC to build 32-bit against
MinGW-built Perl.  I'm considering two ways to achieve this:

1. If $Config{gccversion} is nonempty, add _USE_32BIT_TIME_T.  This will do
   the wrong thing if MinGW changes its default to match modern MSVC.  It will
   do the wrong thing for a Perl built with "gcc -D__MINGW_USE_VC2005_COMPAT".

2. When configuring the build, determine whether to add _USE_32BIT_TIME_T by
   running a test program built with and without that symbol.  Perhaps have
   the test program store and retrieve a PL_modglobal value.  (PL_modglobal
   maps to a PerlInterpreter field that follows the fields sensitive to
   _USE_32BIT_TIME_T, and perlapi documents it since 5.8.0 or earlier.)  This
   is more principled than (1), but it will be more code and may have weird
   interactions with rare Perl build options.

I am inclined toward (2) if it takes no more than roughly a hundred lines of
code, else (1).  Opinions?  I regret investing in 32-bit Windows.  If there's
any OS where a 32-bit PostgreSQL server makes sense today, it's not Windows.


Ideally, $Config{ccflags} would include -D_USE_32BIT_TIME_T for MinGW-built
Perl, like it does for VC6-built Perl.  Considering Perl versions already in
the field, fixing Perl won't change this need to patch PostgreSQL.

Using MinGW to build a PostgreSQL that links to an MSVC-built Perl probably
requires -D__MINGW_USE_VC2005_COMPAT.  I may not bother for now.  We're less
likely to experience that, because Perl binaries advertised on perl.org or in
the PostgreSQL documentation are MinGW-built.


[1] https://gnunet.org/sorting-out-stat-thing

[2] ActivePerl has been MinGW-built for more than five years, and Strawberry
Perl has always been MinGW-built.  I'm guessing Ashutosh tested with an
MSVC-built Perl like
http://get.enterprisedb.com/languagepacks/edb-languagepack-10-3-windows.exe.




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2017-11-30 04:34                                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Michael Paquier <michael.paquier@gmail.com>
  1 sibling, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-11-30 04:34 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

Noah Misch <noah@leadboat.com> writes:
> On Thu, Aug 17, 2017 at 12:15:58PM -0400, Tom Lane wrote:
>> ... it's now looking to me like we should do the above with X = 5.13.4.
>> That won't be a perfect solution, but it's about the best we can
>> readily do.  Realistically, nobody out in the wider world is likely
>> to care about building current PG releases against such old Perl
>> versions on Windows; if we satisfy our older buildfarm critters,
>> it's enough for me.

> MinGW default behavior matches "cl -D_USE_32BIT_TIME_T", and MSVC >= 2005
> default behavior matches "gcc -D__MINGW_USE_VC2005_COMPAT"[1].  MinGW-built
> Perl[2] does not mention _USE_32BIT_TIME_T in $Config{ccflags}, so we
> typically must add _USE_32BIT_TIME_T when using MSVC to build 32-bit against
> MinGW-built Perl.  I'm considering two ways to achieve this:

I don't really have an opinion about the relative merits of these changes,
but why do anything?  The existing solution has the buildfarm happy, and
we've not heard any field complaints that I saw.  I'm not sure we should
spend more time on supporting obsolete toolchain combinations that aren't
represented in the buildfarm.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-11-30 04:41                                                         ` Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Noah Misch @ 2017-11-30 04:41 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Wed, Nov 29, 2017 at 11:34:56PM -0500, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > On Thu, Aug 17, 2017 at 12:15:58PM -0400, Tom Lane wrote:
> >> ... it's now looking to me like we should do the above with X = 5.13.4.
> >> That won't be a perfect solution, but it's about the best we can
> >> readily do.  Realistically, nobody out in the wider world is likely
> >> to care about building current PG releases against such old Perl
> >> versions on Windows; if we satisfy our older buildfarm critters,
> >> it's enough for me.
> 
> > MinGW default behavior matches "cl -D_USE_32BIT_TIME_T", and MSVC >= 2005
> > default behavior matches "gcc -D__MINGW_USE_VC2005_COMPAT"[1].  MinGW-built
> > Perl[2] does not mention _USE_32BIT_TIME_T in $Config{ccflags}, so we
> > typically must add _USE_32BIT_TIME_T when using MSVC to build 32-bit against
> > MinGW-built Perl.  I'm considering two ways to achieve this:
> 
> I don't really have an opinion about the relative merits of these changes,
> but why do anything?  The existing solution has the buildfarm happy, and
> we've not heard any field complaints that I saw.  I'm not sure we should
> spend more time on supporting obsolete toolchain combinations that aren't
> represented in the buildfarm.

It's the other way around.  The buildfarm's 32-bit MSVC animals each use an
obsolete Perl.  PostgreSQL is incompatible with today's 32-bit ActivePerl and
Strawberry Perl.




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2017-11-30 04:45                                                           ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 17:26                                                             ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Tom Lane @ 2017-11-30 04:45 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

Noah Misch <noah@leadboat.com> writes:
> On Wed, Nov 29, 2017 at 11:34:56PM -0500, Tom Lane wrote:
>> I don't really have an opinion about the relative merits of these changes,
>> but why do anything?  The existing solution has the buildfarm happy, and
>> we've not heard any field complaints that I saw.  I'm not sure we should
>> spend more time on supporting obsolete toolchain combinations that aren't
>> represented in the buildfarm.

> It's the other way around.  The buildfarm's 32-bit MSVC animals each use an
> obsolete Perl.  PostgreSQL is incompatible with today's 32-bit ActivePerl and
> Strawberry Perl.

Oh, OK.  In that case, we need to get some representatives of these
more modern builds into the buildfarm while we're at it.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-11-30 17:26                                                             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Andrew Dunstan @ 2017-11-30 17:26 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Noah Misch <noah@leadboat.com>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers



On 11/29/2017 11:45 PM, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
>> On Wed, Nov 29, 2017 at 11:34:56PM -0500, Tom Lane wrote:
>>> I don't really have an opinion about the relative merits of these changes,
>>> but why do anything?  The existing solution has the buildfarm happy, and
>>> we've not heard any field complaints that I saw.  I'm not sure we should
>>> spend more time on supporting obsolete toolchain combinations that aren't
>>> represented in the buildfarm.
>> It's the other way around.  The buildfarm's 32-bit MSVC animals each use an
>> obsolete Perl.  PostgreSQL is incompatible with today's 32-bit ActivePerl and
>> Strawberry Perl.
> Oh, OK.  In that case, we need to get some representatives of these
> more modern builds into the buildfarm while we're at it.
>
> 			



My 32 bit XP machine currawong/frogmouth builds against perl 5.16.3,
build dated 2014.

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-12-09 19:31                                                             ` Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  1 sibling, 1 reply; 94+ messages in thread

From: Noah Misch @ 2017-12-09 19:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; chris@chrullrich.net; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > On Wed, Nov 29, 2017 at 11:34:56PM -0500, Tom Lane wrote:
> >> I don't really have an opinion about the relative merits of these changes,
> >> but why do anything?  The existing solution has the buildfarm happy, and
> >> we've not heard any field complaints that I saw.  I'm not sure we should
> >> spend more time on supporting obsolete toolchain combinations that aren't
> >> represented in the buildfarm.
> 
> > It's the other way around.  The buildfarm's 32-bit MSVC animals each use an
> > obsolete Perl.  PostgreSQL is incompatible with today's 32-bit ActivePerl and
> > Strawberry Perl.
> 
> Oh, OK.  In that case, we need to get some representatives of these
> more modern builds into the buildfarm while we're at it.

Yep.  Among machines already in the buildfarm, the one running member
woodlouse is the best candidate for this.  Its owner could install
http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
and setup another animal on the same machine that builds 32-bit and enables
Perl.  Christian, are you interested in doing this?




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* RE: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2017-12-10 12:36                                                               ` Christian Ullrich <chris@chrullrich.net>
  2017-12-10 19:46                                                                 ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2018-01-21 10:34                                                                 ` Re: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  0 siblings, 2 replies; 94+ messages in thread

From: Christian Ullrich @ 2017-12-10 12:36 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

* Noah Misch wrote:

> On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
>> Oh, OK.  In that case, we need to get some representatives of these
>> more modern builds into the buildfarm while we're at it.
> 
> Yep.  Among machines already in the buildfarm, the one running member
> woodlouse is the best candidate for this.  Its owner could install
> http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
> and setup another animal on the same machine that builds 32-bit and enables
> Perl.  Christian, are you interested in doing this?

Ready to go, waiting for animal assignment. For now, I can confirm that it works, that is, the buildfarm --test run is successful.

Although I have to admit, I fail to see the need for Windows x86 builds, too. Who in their right mind would want them today?

--
Christian




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
@ 2017-12-10 19:46                                                                 ` Noah Misch <noah@leadboat.com>
  2018-01-11 05:08                                                                   ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Noah Misch @ 2017-12-10 19:46 UTC (permalink / raw)
  To: Christian Ullrich <chris@chrullrich.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

On Sun, Dec 10, 2017 at 12:36:13PM +0000, Christian Ullrich wrote:
> * Noah Misch wrote:
> > On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
> >> Oh, OK.  In that case, we need to get some representatives of these
> >> more modern builds into the buildfarm while we're at it.
> > 
> > Yep.  Among machines already in the buildfarm, the one running member
> > woodlouse is the best candidate for this.  Its owner could install
> > http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
> > and setup another animal on the same machine that builds 32-bit and enables
> > Perl.  Christian, are you interested in doing this?
> 
> Ready to go, waiting for animal assignment. For now, I can confirm that it works, that is, the buildfarm --test run is successful.

Thanks!

> Although I have to admit, I fail to see the need for Windows x86 builds, too. Who in their right mind would want them today?

I can't see installing a 32-bit Windows postmaster in 2018.  The 32-bit libpq
might be useful.  Download statistics for the binary distributions would be
informative.  On the other hand, removing 32-bit Windows support would
eliminate three veteran buildfarm animals, and maintenance was cheap in the
few years before this thread.  I don't think today is the day to remove
support, but it's coming one of these years.




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  2017-12-10 19:46                                                                 ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2018-01-11 05:08                                                                   ` Noah Misch <noah@leadboat.com>
  2018-01-11 06:42                                                                     ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  2018-01-11 15:16                                                                     ` Re: pl/perl extension fails on Windows Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  0 siblings, 2 replies; 94+ messages in thread

From: Noah Misch @ 2018-01-11 05:08 UTC (permalink / raw)
  To: Christian Ullrich <chris@chrullrich.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

On Sun, Dec 10, 2017 at 11:46:08AM -0800, Noah Misch wrote:
> On Sun, Dec 10, 2017 at 12:36:13PM +0000, Christian Ullrich wrote:
> > * Noah Misch wrote:
> > > On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
> > >> Oh, OK.  In that case, we need to get some representatives of these
> > >> more modern builds into the buildfarm while we're at it.
> > > 
> > > Yep.  Among machines already in the buildfarm, the one running member
> > > woodlouse is the best candidate for this.  Its owner could install
> > > http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
> > > and setup another animal on the same machine that builds 32-bit and enables
> > > Perl.  Christian, are you interested in doing this?
> > 
> > Ready to go, waiting for animal assignment. For now, I can confirm that it works, that is, the buildfarm --test run is successful.
> 
> Thanks!

Did the animal assignment come through?  I don't see such an animal reporting.




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* RE: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  2017-12-10 19:46                                                                 ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2018-01-11 05:08                                                                   ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2018-01-11 06:42                                                                     ` Christian Ullrich <chris@chrullrich.net>
  1 sibling, 0 replies; 94+ messages in thread

From: Christian Ullrich @ 2018-01-11 06:42 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

* From: Noah Misch [mailto:noah@leadboat.com]

> > > Ready to go, waiting for animal assignment. For now, I can
> confirm that it works, that is, the buildfarm --test run is
> successful.

> Did the animal assignment come through?  I don't see such an animal
> reporting.

No, not yet. Sorry, I lost track of it, or I would have mentioned it again earlier.

-- 
Christian


^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  2017-12-10 19:46                                                                 ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2018-01-11 05:08                                                                   ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2018-01-11 15:16                                                                     ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Andrew Dunstan @ 2018-01-11 15:16 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; Christian Ullrich <chris@chrullrich.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers



On 01/11/2018 12:08 AM, Noah Misch wrote:
> On Sun, Dec 10, 2017 at 11:46:08AM -0800, Noah Misch wrote:
>> On Sun, Dec 10, 2017 at 12:36:13PM +0000, Christian Ullrich wrote:
>>> * Noah Misch wrote:
>>>> On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
>>>>> Oh, OK.  In that case, we need to get some representatives of these
>>>>> more modern builds into the buildfarm while we're at it.
>>>> Yep.  Among machines already in the buildfarm, the one running member
>>>> woodlouse is the best candidate for this.  Its owner could install
>>>> http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
>>>> and setup another animal on the same machine that builds 32-bit and enables
>>>> Perl.  Christian, are you interested in doing this?
>>> Ready to go, waiting for animal assignment. For now, I can confirm that it works, that is, the buildfarm --test run is successful.
>> Thanks!
> Did the animal assignment come through?  I don't see such an animal reporting.


Looks like it's still in the queue. Will approve now.

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
@ 2018-01-21 10:34                                                                 ` Christian Ullrich <chris@chrullrich.net>
  2018-01-21 22:19                                                                   ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  1 sibling, 1 reply; 94+ messages in thread

From: Christian Ullrich @ 2018-01-21 10:34 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

* Christian Ullrich wrote:

> * Noah Misch wrote:
> 
>> On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
>>> Oh, OK.  In that case, we need to get some representatives of these
>>> more modern builds into the buildfarm while we're at it.
>>
>> Yep.  Among machines already in the buildfarm, the one running member
>> woodlouse is the best candidate for this.  Its owner could install
>> http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
>> and setup another animal on the same machine that builds 32-bit and enables
>> Perl.  Christian, are you interested in doing this?
> 
> Ready to go, waiting for animal assignment. For now, I can confirm that it works, that is, the buildfarm --test run is successful.

Up and running now, name is whelk, first report on REL9_6_STABLE.

Sorry it took me another ten days to complete the configuration.

-- 
Christian




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:41                                                         ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:45                                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-12-09 19:31                                                             ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-12-10 12:36                                                               ` RE: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
  2018-01-21 10:34                                                                 ` Re: pl/perl extension fails on Windows Christian Ullrich <chris@chrullrich.net>
@ 2018-01-21 22:19                                                                   ` Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 94+ messages in thread

From: Noah Misch @ 2018-01-21 22:19 UTC (permalink / raw)
  To: Christian Ullrich <chris@chrullrich.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers; Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

On Sun, Jan 21, 2018 at 11:34:07AM +0100, Christian Ullrich wrote:
> * Christian Ullrich wrote:
> >* Noah Misch wrote:
> >>On Wed, Nov 29, 2017 at 11:45:35PM -0500, Tom Lane wrote:
> >>>Oh, OK.  In that case, we need to get some representatives of these
> >>>more modern builds into the buildfarm while we're at it.
> >>
> >>Yep.  Among machines already in the buildfarm, the one running member
> >>woodlouse is the best candidate for this.  Its owner could install
> >>http://strawberryperl.com/download/5.26.1.1/strawberry-perl-5.26.1.1-32bit.msi
> >>and setup another animal on the same machine that builds 32-bit and enables
> >>Perl.  Christian, are you interested in doing this?
> >
> >Ready to go, waiting for animal assignment. For now, I can confirm that it works, that is, the buildfarm --test run is successful.
> 
> Up and running now, name is whelk, first report on REL9_6_STABLE.
> 
> Sorry it took me another ten days to complete the configuration.

This is great.  Thanks.

Buildfarm metadata reports whelk using "Microsoft Visual C++ 2010", but the
run logs show it's using MSVC 2013, like woodlouse does.  Would you update
that buildfarm metadata (with update_personality.pl)?




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
  2017-11-30 04:34                                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-11-30 04:41                                                         ` Michael Paquier <michael.paquier@gmail.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Michael Paquier @ 2017-11-30 04:41 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Noah Misch <noah@leadboat.com>; Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Thu, Nov 30, 2017 at 1:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Noah Misch <noah@leadboat.com> writes:
>> On Thu, Aug 17, 2017 at 12:15:58PM -0400, Tom Lane wrote:
>>> ... it's now looking to me like we should do the above with X = 5.13.4.
>>> That won't be a perfect solution, but it's about the best we can
>>> readily do.  Realistically, nobody out in the wider world is likely
>>> to care about building current PG releases against such old Perl
>>> versions on Windows; if we satisfy our older buildfarm critters,
>>> it's enough for me.
>
>> MinGW default behavior matches "cl -D_USE_32BIT_TIME_T", and MSVC >= 2005
>> default behavior matches "gcc -D__MINGW_USE_VC2005_COMPAT"[1].  MinGW-built
>> Perl[2] does not mention _USE_32BIT_TIME_T in $Config{ccflags}, so we
>> typically must add _USE_32BIT_TIME_T when using MSVC to build 32-bit against
>> MinGW-built Perl.  I'm considering two ways to achieve this:
>
> I don't really have an opinion about the relative merits of these changes,
> but why do anything?  The existing solution has the buildfarm happy, and
> we've not heard any field complaints that I saw.  I'm not sure we should
> spend more time on supporting obsolete toolchain combinations that aren't
> represented in the buildfarm.

I agree with this position. If people are looking for getting better
coverage about weird component combinations, I'd like to think that
they should provide an animal so as support is live and not
investigated afterwards. Remember for example the recent thread about
overlayfs (https://www.postgresql.org/message-id/20171107135454.lbelbbvfgadljmuj@home.ouaza.com).
On top of that this thread deals with rather old components with 32b
stuff on Windows..
-- 
Michael




^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-08 14:49                     ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-08 16:15                       ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-09 20:25                         ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 12:30                           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-08-10 14:17                             ` Re: pl/perl extension fails on Windows Robert Haas <robertmhaas@gmail.com>
  2017-08-10 14:36                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-10 15:34                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 09:42                                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 13:42                                     ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-14 20:37                                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 08:12                                         ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 13:58                                           ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 14:16                                             ` Re: pl/perl extension fails on Windows Dave Page <dpage@postgresql.org>
  2017-08-17 14:57                                               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 15:30                                                 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-08-17 16:15                                                   ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-11-30 04:14                                                     ` Re: pl/perl extension fails on Windows Noah Misch <noah@leadboat.com>
@ 2017-12-04 02:29                                                       ` Noah Misch <noah@leadboat.com>
  1 sibling, 0 replies; 94+ messages in thread

From: Noah Misch @ 2017-12-04 02:29 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dave Page <dpage@postgresql.org>; Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; Robert Haas <robertmhaas@gmail.com>; pgsql-hackers

On Wed, Nov 29, 2017 at 08:14:41PM -0800, Noah Misch wrote:
> 1. If $Config{gccversion} is nonempty, add _USE_32BIT_TIME_T.  This will do
>    the wrong thing if MinGW changes its default to match modern MSVC.  It will
>    do the wrong thing for a Perl built with "gcc -D__MINGW_USE_VC2005_COMPAT".
> 
> 2. When configuring the build, determine whether to add _USE_32BIT_TIME_T by
>    running a test program built with and without that symbol.  Perhaps have
>    the test program store and retrieve a PL_modglobal value.  (PL_modglobal
>    maps to a PerlInterpreter field that follows the fields sensitive to
>    _USE_32BIT_TIME_T, and perlapi documents it since 5.8.0 or earlier.)  This
>    is more principled than (1), but it will be more code and may have weird
>    interactions with rare Perl build options.
> 
> I am inclined toward (2) if it takes no more than roughly a hundred lines of
> code, else (1).  Opinions?  I regret investing in 32-bit Windows.  If there's
> any OS where a 32-bit PostgreSQL server makes sense today, it's not Windows.

Here's an implementation of (2).  This is more intricate than I hoped.  One
could argue for (1), but I estimate (2) wins by a nose.  I successfully tested
http://strawberryperl.com/download/5.14.4.1/strawberry-perl-5.14.4.1-32bit.msi
(Perl 5.14.4; MinGW-built; must have -D_USE_32BIT_TIME_T) and
http://get.enterprisedb.com/languagepacks/edb-languagepack-10-3-windows.exe
(Perl 5.24.0; MSVC-built; must not have -D_USE_32BIT_TIME_T).  I also tried
http://strawberryperl.com/download/5.8.9/strawberry-perl-5.8.9.5.msi, which
experienced a StackHash_0a9e crash during PERL_SYS_INIT3(), with or without
-D_USE_32BIT_TIME_T.  I expect that breakage is orthogonal.  I didn't have
ready access to obsolete MSVC-built Perl, so it will be interesting to see how
the buildfarm likes this.

Attachments:

time_t-msvc-v1.patch (text/plain, 10.3K) download MSVC: Test whether 32-bit Perl needs -D_USE_32BIT_TIME_T. Commits 5a5c2feca3fd858e70ea348822595547e6fa6c15 and b5178c5d08ca59e30f9d9428fa6fdb2741794e65 introduced support for modern MSVC-built, 32-bit Perl, but they broke use of MinGW-built, 32-bit Perl distributions like Strawberry Perl and modern ActivePerl. Perl has no robust means to report whether it expects a -D_USE_32BIT_TIME_T ABI, so test this. Back-patch to 9.3 (all supported versions). The chief alternative was a heuristic of adding -D_USE_32BIT_TIME_T when $Config{gccversion} is nonempty. That banks on every gcc-built Perl using the same ABI. gcc could change its default ABI the way MSVC once did, and one could build Perl with gcc and the non-default ABI. The GNU make build system could benefit from a similar test, without which it does not support MSVC-built Perl. For now, just add a comment. Most users taking the special step of building Perl with MSVC probably build PostgreSQL with MSVC. Discussion: https://postgr.es/m/20171130041441.GA3161526@rfd.leadboat.com diff --git a/config/perl.m4 b/config/perl.m4 index 76b1a92..caefb07 100644 --- a/config/perl.m4 +++ b/config/perl.m4 @@ -48,19 +48,23 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS], # PGAC_CHECK_PERL_EMBED_CCFLAGS # ----------------------------- -# We selectively extract stuff from $Config{ccflags}. We don't really need -# anything except -D switches, and other sorts of compiler switches can -# actively break things if Perl was compiled with a different compiler. -# Moreover, although Perl likes to put stuff like -D_LARGEFILE_SOURCE and -# -D_FILE_OFFSET_BITS=64 here, it would be fatal to try to compile PL/Perl -# to a different libc ABI than core Postgres uses. The available information -# says that all the symbols that affect Perl's own ABI begin with letters, -# so it should be sufficient to adopt -D switches for symbols not beginning -# with underscore. An exception is that we need to let through -# -D_USE_32BIT_TIME_T if it's present. (We probably could restrict that to -# only get through on Windows, but for the moment we let it through always.) -# For debugging purposes, let's have the configure output report the raw -# ccflags value as well as the set of flags we chose to adopt. +# We selectively extract stuff from $Config{ccflags}. For debugging purposes, +# let's have the configure output report the raw ccflags value as well as the +# set of flags we chose to adopt. We don't really need anything except -D +# switches, and other sorts of compiler switches can actively break things if +# Perl was compiled with a different compiler. Moreover, although Perl likes +# to put stuff like -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 here, it +# would be fatal to try to compile PL/Perl to a different libc ABI than core +# Postgres uses. The available information says that most symbols that affect +# Perl's own ABI begin with letters, so it's almost sufficient to adopt -D +# switches for symbols not beginning with underscore. Some exceptions are the +# Windows-specific -D_USE_32BIT_TIME_T and -D__MINGW_USE_VC2005_COMPAT; see +# Mkvcbuild.pm for details. We absorb the former when Perl reports it. Perl +# never reports the latter, and we don't attempt to deduce when it's needed. +# Consequently, we don't support using MinGW to link to MSVC-built Perl. As +# of 2017, all supported ActivePerl and Strawberry Perl are MinGW-built. If +# that changes or an MSVC-built Perl distribution becomes prominent, we can +# revisit this limitation. AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS], [AC_REQUIRE([PGAC_PATH_PERL]) AC_MSG_CHECKING([for CFLAGS recommended by Perl]) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 4c2e12e..93f364a 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -28,6 +28,7 @@ my $libpgcommon; my $libpgfeutils; my $postgres; my $libpq; +my @unlink_on_exit; # Set of variables for modules in contrib/ and src/test/modules/ my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' }; @@ -517,34 +518,154 @@ sub mkvcbuild my $plperl = $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl'); $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE'); + $plperl->AddReference($postgres); + + my $perl_path = $solution->{options}->{perl} . '\lib\CORE\*perl*'; + + # ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a + my @perl_libs = + grep { /perl\d+\.lib$|libperl\d+\.a$/ } glob($perl_path); + if (@perl_libs == 1) + { + $plperl->AddLibrary($perl_libs[0]); + } + else + { + die +"could not identify perl library version matching pattern $perl_path\n"; + } # Add defines from Perl's ccflags; see PGAC_CHECK_PERL_EMBED_CCFLAGS my @perl_embed_ccflags; foreach my $f (split(" ", $Config{ccflags})) { - if ( $f =~ /^-D[^_]/ - || $f =~ /^-D_USE_32BIT_TIME_T/) + if ($f =~ /^-D[^_]/) { $f =~ s/\-D//; push(@perl_embed_ccflags, $f); } } - # Perl versions before 5.13.4 don't provide -D_USE_32BIT_TIME_T - # regardless of how they were built. On 32-bit Windows, assume - # such a version was built with a pre-MSVC-2005 compiler, and - # define the symbol anyway, so that we are compatible if we're - # being built with a later MSVC version. - push(@perl_embed_ccflags, '_USE_32BIT_TIME_T') - if $solution->{platform} eq 'Win32' - && $Config{PERL_REVISION} == 5 - && ($Config{PERL_VERSION} < 13 - || ( $Config{PERL_VERSION} == 13 - && $Config{PERL_SUBVERSION} < 4)); - - # Also, a hack to prevent duplicate definitions of uid_t/gid_t + # hack to prevent duplicate definitions of uid_t/gid_t push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID'); + # Windows offers several 32-bit ABIs. Perl is sensitive to + # sizeof(time_t), one of the ABI dimensions. To get 32-bit time_t, + # use "cl -D_USE_32BIT_TIME_T" or plain "gcc". For 64-bit time_t, use + # "gcc -D__MINGW_USE_VC2005_COMPAT" or plain "cl". Before MSVC 2005, + # plain "cl" chose 32-bit time_t. PostgreSQL doesn't support building + # with pre-MSVC-2005 compilers, but it does support linking to Perl + # built with such a compiler. MSVC-built Perl 5.13.4 and later report + # -D_USE_32BIT_TIME_T in $Config{ccflags} if applicable, but + # MinGW-built Perl never reports -D_USE_32BIT_TIME_T despite typically + # needing it. Ignore the $Config{ccflags} opinion about + # -D_USE_32BIT_TIME_T, and use a runtime test to deduce the ABI Perl + # expects. Specifically, test use of PL_modglobal, which maps to a + # PerlInterpreter field whose position depends on sizeof(time_t). + if ($solution->{platform} eq 'Win32') + { + my $source_file = 'conftest.c'; + my $obj = 'conftest.obj'; + my $exe = 'conftest.exe'; + my @conftest = ($source_file, $obj, $exe); + push @unlink_on_exit, @conftest; + unlink $source_file; + open my $o, '>', $source_file + || croak "Could not write to $source_file"; + print $o ' + /* compare to plperl.h */ + #define __inline__ __inline + #define PERL_NO_GET_CONTEXT + #include <EXTERN.h> + #include <perl.h> + + int + main(int argc, char **argv) + { + int dummy_argc = 1; + char *dummy_argv[1] = {""}; + char *dummy_env[1] = {NULL}; + static PerlInterpreter *interp; + + PERL_SYS_INIT3(&dummy_argc, (char ***) &dummy_argv, + (char ***) &dummy_env); + interp = perl_alloc(); + perl_construct(interp); + { + dTHX; + const char key[] = "dummy"; + + PL_exit_flags |= PERL_EXIT_DESTRUCT_END; + hv_store(PL_modglobal, key, sizeof(key) - 1, newSViv(1), 0); + return hv_fetch(PL_modglobal, key, sizeof(key) - 1, 0) == NULL; + } + } +'; + close $o; + + # Build $source_file with a given #define, and return a true value + # if a run of the resulting binary exits successfully. + my $try_define = sub { + my $define = shift; + + unlink $obj, $exe; + my @cmd = ( + 'cl', + '-I' . $solution->{options}->{perl} . '/lib/CORE', + (map { "-D$_" } @perl_embed_ccflags, $define || ()), + $source_file, + '/link', + $perl_libs[0]); + my $compile_output = `@cmd 2>&1`; + -f $exe || die "Failed to build Perl test:\n$compile_output"; + + { + + # Some builds exhibit runtime failure through Perl warning + # 'Can't spawn "conftest.exe"'; supress that. + no warnings; + + # Disable error dialog boxes like we do in the postmaster. + # Here, we run code that triggers relevant errors. + use Win32API::File qw(SetErrorMode :SEM_); + my $oldmode = SetErrorMode( + SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); + system(".\\$exe"); + SetErrorMode($oldmode); + } + + return !($? >> 8); + }; + + my $define_32bit_time = '_USE_32BIT_TIME_T'; + my $ok_now = $try_define->(undef); + my $ok_32bit = $try_define->($define_32bit_time); + unlink @conftest; + if (!$ok_now && !$ok_32bit) + { + + # Unsupported configuration. Since we used %Config from the + # Perl running the build scripts, this is expected if + # attempting to link with some other Perl. + die "Perl test fails with or without -D$define_32bit_time"; + } + elsif ($ok_now && $ok_32bit) + { + + # Resulting build may work, but it's especially important to + # verify with "vcregress plcheck". A refined test may avoid + # this outcome. + warn "Perl test passes with or without -D$define_32bit_time"; + } + elsif ($ok_32bit) + { + push(@perl_embed_ccflags, $define_32bit_time); + } # else $ok_now, hence no flag required + } + + print "CFLAGS recommended by Perl: $Config{ccflags}\n"; + print "CFLAGS to compile embedded Perl: ", + (join ' ', map { "-D$_" } @perl_embed_ccflags), "\n"; foreach my $f (@perl_embed_ccflags) { $plperl->AddDefine($f); @@ -614,20 +735,6 @@ sub mkvcbuild die 'Failed to create plperl_opmask.h' . "\n"; } } - $plperl->AddReference($postgres); - my $perl_path = $solution->{options}->{perl} . '\lib\CORE\*perl*'; - # ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a - my @perl_libs = - grep { /perl\d+\.lib$|libperl\d+\.a$/ } glob($perl_path); - if (@perl_libs == 1) - { - $plperl->AddLibrary($perl_libs[0]); - } - else - { - die -"could not identify perl library version matching pattern $perl_path\n"; - } # Add transform module dependent on plperl my $hstore_plperl = AddTransformModule( @@ -956,4 +1063,9 @@ sub AdjustModule } } +END +{ + unlink @unlink_on_exit; +} + 1;
^ permalink raw reply [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
@ 2017-08-14 16:51                     ` Christoph Berg <myon@debian.org>
  2017-08-14 17:16                       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 94+ messages in thread

From: Christoph Berg @ 2017-08-14 16:51 UTC (permalink / raw)
  To: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

Re: Sandeep Thakkar 2017-08-08 <CANFyU96tucWPECj8Oy5cevuVwyijVoEZ_Dey08eCEhPk9TM85A@mail.gmail.com>
> Hi
> 
> An update from beta3 build: We are no longer seeing this issue (handshake
> failure) on Windows 64bit, but on Windows 32bit it still persists.

HEAD as of 5a5c2feca still has the same problem on kfreebsd. Is there
anything I could dump so we understand the problem better?

Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread

* Re: pl/perl extension fails on Windows
  2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-07-12 15:35 ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-12 15:49   ` Re: pl/perl extension fails on Windows Dave Page <dpage@pgadmin.org>
  2017-07-13 19:53     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-28 21:14       ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-30 21:14         ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 03:48           ` Re: pl/perl extension fails on Windows Ashutosh Sharma <ashu.coek88@gmail.com>
  2017-07-31 08:40             ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-07-31 13:39               ` Re: pl/perl extension fails on Windows Tom Lane <tgl@sss.pgh.pa.us>
  2017-07-31 16:45                 ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
  2017-08-08 12:37                   ` Re: pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
  2017-08-14 16:51                     ` Re: pl/perl extension fails on Windows Christoph Berg <myon@debian.org>
@ 2017-08-14 17:16                       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 94+ messages in thread

From: Tom Lane @ 2017-08-14 17:16 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; +Cc: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>; Ashutosh Sharma <ashu.coek88@gmail.com>; pgsql-hackers

Christoph Berg <myon@debian.org> writes:
> HEAD as of 5a5c2feca still has the same problem on kfreebsd. Is there
> anything I could dump so we understand the problem better?

Yeah, I did not expect that 5a5c2feca would change anything on
non-Windows.

What we need to do is verify that PL/Perl's idea of
sizeof(PerlInterpreter) is different from Perl's own idea, and then
find out why --- ie, just which fields have different size/alignment
in the two compiles.

You mentioned upthread that configure shows this:

> checking for CFLAGS recommended by Perl... -D_REENTRANT -D_GNU_SOURCE
> -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> checking for CFLAGS to compile embedded Perl... -DDEBIAN

If the source of the problem is the same mechanism as it was for the
other platforms, then presumably the issue is that we need one or more
of
	-D_REENTRANT
	-D_GNU_SOURCE
	-D_LARGEFILE_SOURCE
	-D_FILE_OFFSET_BITS=64
to be defined while building PL/Perl.  Now, it couldn't be -D_GNU_SOURCE
that's at issue, because we turn that on in src/template/linux:

# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"

(That ancient comment is pretty interesting in this connection, isn't it.)

And I'd have thought that _LARGEFILE_SOURCE=1 and _FILE_OFFSET_BITS=64
were the default behavior on any modern platform anyway, but maybe
kfreebsd is weird about that.  Anyway, you could try sticking combinations
of these symbols into perl_embed_ccflags in src/Makefile.global and
rebuilding PL/Perl to see if the problem goes away; if that works it would
give us a leg up on where the problem is.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 94+ messages in thread


end of thread, other threads:[~2018-01-21 22:19 UTC | newest]

Thread overview: 94+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12 12:19 pl/perl extension fails on Windows Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
2017-07-12 15:35 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-12 15:49   ` Dave Page <dpage@pgadmin.org>
2017-07-12 18:31     ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-13 12:08       ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-13 12:34         ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-13 14:36           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-13 16:14             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-13 17:00               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-19 15:48                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-19 16:12                   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-19 16:56                     ` Robert Haas <robertmhaas@gmail.com>
2017-07-19 17:44                     ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-19 18:09                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-19 21:01                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-24 06:28                         ` Noah Misch <noah@leadboat.com>
2017-07-25 12:58                           ` Amit Kapila <amit.kapila16@gmail.com>
2017-07-25 14:37                             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-25 14:50                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-25 14:38                             ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-25 14:23                         ` Robert Haas <robertmhaas@gmail.com>
2017-07-25 15:00                           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-25 15:14                             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-25 15:26                             ` Robert Haas <robertmhaas@gmail.com>
2017-07-25 15:32                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-25 15:39                                 ` Robert Haas <robertmhaas@gmail.com>
2017-07-25 15:39                                 ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-26 03:08                           ` Robert Haas <robertmhaas@gmail.com>
2017-07-26 03:21                             ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-26 14:26                               ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-27 13:08                                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-27 14:21                                 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-27 16:34                                   ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-27 18:36                                     ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-27 18:46                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-27 20:14                                   ` Robert Haas <robertmhaas@gmail.com>
2017-07-27 20:33                                     ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-27 21:28                                       ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-07-27 22:50                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-28 09:00                                         ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-28 13:52                                           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-28 16:16                                             ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-28 16:35                                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-28 17:04                                                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-28 18:35                                                   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-28 19:47                                                     ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-28 21:15                                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-14 06:35           ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-13 19:53     ` Christoph Berg <myon@debian.org>
2017-07-28 21:14       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-30 21:14         ` Christoph Berg <myon@debian.org>
2017-07-30 21:30           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-31 03:48           ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-31 06:11             ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-07-31 08:40             ` Christoph Berg <myon@debian.org>
2017-07-31 13:39               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-07-31 16:45                 ` Christoph Berg <myon@debian.org>
2017-08-08 12:37                   ` Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
2017-08-08 14:49                     ` Robert Haas <robertmhaas@gmail.com>
2017-08-08 16:15                       ` Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
2017-08-09 20:25                         ` Robert Haas <robertmhaas@gmail.com>
2017-08-10 12:30                           ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-08-10 14:17                             ` Robert Haas <robertmhaas@gmail.com>
2017-08-10 14:36                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-10 15:11                                 ` Robert Haas <robertmhaas@gmail.com>
2017-08-10 15:22                                 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-10 15:23                                 ` Ashutosh Sharma <ashu.coek88@gmail.com>
2017-08-10 15:34                                 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-14 09:42                                   ` Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
2017-08-14 13:42                                     ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-14 20:37                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-17 08:12                                         ` Dave Page <dpage@postgresql.org>
2017-08-17 13:58                                           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-17 14:16                                             ` Dave Page <dpage@postgresql.org>
2017-08-17 14:57                                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-17 15:30                                                 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-17 16:15                                                   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 04:14                                                     ` Noah Misch <noah@leadboat.com>
2017-11-30 04:34                                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 04:41                                                         ` Noah Misch <noah@leadboat.com>
2017-11-30 04:45                                                           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 17:26                                                             ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-12-09 19:31                                                             ` Noah Misch <noah@leadboat.com>
2017-12-10 12:36                                                               ` Christian Ullrich <chris@chrullrich.net>
2017-12-10 19:46                                                                 ` Noah Misch <noah@leadboat.com>
2018-01-11 05:08                                                                   ` Noah Misch <noah@leadboat.com>
2018-01-11 06:42                                                                     ` Christian Ullrich <chris@chrullrich.net>
2018-01-11 15:16                                                                     ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2018-01-21 10:34                                                                 ` Christian Ullrich <chris@chrullrich.net>
2018-01-21 22:19                                                                   ` Noah Misch <noah@leadboat.com>
2017-11-30 04:41                                                         ` Michael Paquier <michael.paquier@gmail.com>
2017-12-04 02:29                                                       ` Noah Misch <noah@leadboat.com>
2017-08-14 16:51                     ` Christoph Berg <myon@debian.org>
2017-08-14 17:16                       ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox