Re: Re: [COMMITTERS] pgsql: Initialise perl library as documented in perl API.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Initialise perl library as documented in perl API.
Date: 2009-06-05 13:46:01
Message-ID: 4A292199.6030201@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>
>>> That's what we have a buildfarm for ;-) There's a failure on FBSD
>>> too by the look of it. I'll dig some more to see what I can find.
>>>
>>
>> I see this when building HEAD on Fedora 10:
>>
>> plperl.c: In function 'plperl_init_interp':
>> plperl.c:450: warning: null argument where non-null required
>> (argument 3)
>>
>> Seems like a good hint ...
>>
>>
>>
> Yeah. I didn't get that. But the odd thing is that on 5.8 especially
> it shouldn't matter.
>
> perl 5.8.8's perl.h has:
>
> #ifndef PERL_SYS_INIT3
> # define PERL_SYS_INIT3(argvp,argcp,envp) PERL_SYS_INIT(argvp,argcp)
> #endif
>
>
> and the only place it's defined elsewhere that I can see is for OS2
> (for anyone still running it!). These two Unixware machines have
> 5.8.8. and the FBSD machine has 5.8.7. So surely it can't be that,
> unless I'm missing something badly.
>
> The unixish.h file has this on 5.8:
>
> # define PERL_SYS_INIT(c,v) MALLOC_CHECK_TAINT2(*c,*v)
> PERL_FPU_INIT MALLOC_INIT
>
> I'm guessing the problem is actually somewhere in there.
>
>

[hours of digging later]

On FBSD at least, this is failing in the function Perl_do_taint(). I
can't see anything too terrible in the source for this, but to dig
further I'd have to build another perl with debugging turned on. Anyway,
it turns out that this actually isn't called at all if Perl is
configured to use its own malloc() routines instead of those supplied by
the system, as is the case on Fedora, for example, but not FBSD.

So we have a bit of a dilemma. We know that this initialization is
required by the Perl API, and we know that some platforms fail without
it, and we also know that this fails on some platforms which use the
system's malloc() for perl.

I think we need to float a bug upstream to the perl guys on this, but as
a holding position I suggest that we alter the #ifdef test to avoid
calling PERL_SYS_INIT3() where MYMALLOC is defined. It's ugly, but I
can't think of another simple way around it (and we've done worse things
to accommodate platform weirdness ;-) )

BTW, it's not caused by passing NULL as the third argument of
PERL_SYS_INIT3() - changing that was the first thing I tried.

cheers

andrew

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2009-06-05 13:53:53 Re: Re: [COMMITTERS] pgsql: Initialise perl library as documented in perl API.
Previous Message Bruce Momjian 2009-06-05 13:40:32 pgsql: Remove sleep() from backup script example; not needed anymore.

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-06-05 13:51:36 Re: PostgreSQL Developer meeting minutes up
Previous Message Bruce Momjian 2009-06-05 13:40:44 Re: Simple, safe hot backup and recovery