pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michal Leinweber <lei@aswsyst.cz>
To: Alex Hunsaker <badalex@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tim Bunce <Tim.Bunce@pobox.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13638: Exception texts from plperl has bad encoding
Date: Fri, 02 Oct 2015 13:07:17 +0200
Message-ID: <8a47f0bd70f38a49fdcb8d7ef93f7694@leisoft.cz> (raw)
In-Reply-To: <CAFaPBrQJhiXXXioraiZL_-9funU9cbqyknAsxYZ_O5zmHCCOEg@mail.gmail.com>
References: <20150925112345.26913.28407@wrigleys.postgresql.org>
	<18105.1443208708@sss.pgh.pa.us>
	<18478.1443209624@sss.pgh.pa.us>
	<20150925195120.GL295765@alvherre.pgsql>
	<20150927141148.GA1416@timac.local>
	<13303.1443397579@sss.pgh.pa.us>
	<CAFaPBrR-yd0fFAh+tNQ=NQ_HW=xMsbZgS8dnRjF6x6FtnSTJTQ@mail.gmail.com>
	<23013.1443457683@sss.pgh.pa.us>
	<CAFaPBrQJhiXXXioraiZL_-9funU9cbqyknAsxYZ_O5zmHCCOEg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hello,

just reporting that the attached patch solves my problem. Thanks.

Best Regards
     Michal Leinweber

On 2015-09-29 05:51, Alex Hunsaker wrote:

> On Mon, Sep 28, 2015 at 10:28 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
>> Alex Hunsaker <badalex@gmail.com> writes:
>>> Yeah, I was just looking at that. I couldn't find a good way to 
>>> support
>>> 5.8. Doing: ...
>>> Works, but screws up the error line numbers.
>> 
>> I looked into this and determined that the problem is that the 
>> location
>> info doesn't get appended to ERRSV until after Perl has popped the 
>> stack.
> 
>> I tried this implementation of croak_cstr: ...
> 
> Yeah that seems to work great!
> 
>> * I don't see mess() in the perlapi man page, so is it okay to use?
> 
> Looks like they added it to perlapi in 5.12, given that it exists and 
> seems to work in 5.8 and 5.10 I think we are ok to use it. I tested 
> your above usage on 5.8, 5.10, 5.12.
> 
>> * Is there any leakage involved in this?  (I don't know what prompted
>> you to add sv_2mortal() to the other implementation, but maybe we need
>> it here too?)
> 
> No, $@ is global and mess() also uses a global. (unless perl is 
> destructing).
> 
> In the croak_sv() case, we never use/assign what cstr2sv() returns 
> anywhere in perl land, so it always has a refcount of 1. We have 
> similar usage of sv_2mortal(cstr2sv()) albeit not on the same line in 
> plperl.c.
> 
>> * Is there some other reason why this is wrong or a bad idea?  Since 
>> we'd
>> only use this with versions lacking croak_sv(), future-proofing 
>> doesn't
>> seem like a good argument against it, but maybe there is another one.
> 
> The only argument that comes to mind is AFAIK perl 5.8 and 5.10 are 
> more or less unmaintained so it might not be worth the effort to make 
> them work. And it's been this way forever.
> 
>> BTW, I think we can't actually use this regression test case, [...]  
>> However,
> 
>> other test cases may already provide sufficient coverage if we're not
>> going to test encoding conversion.
> 
> Agreed. I'll attach it separately just for easy verification that 
> everything is working as intended.
> 
>> Also, I'm inclined to leave do_util_elog() alone other than replacing
>> croak("%s", edata->message) with croak_cstr(edata->message).
> 
> Done that way.
> 
> The attached was tested on 5.8.9, 5.10.1, 5.12.5, 5.14.4, 5.18.2 and 
> 5.22.0.


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



view thread (15+ messages)

Message-ID: <8a47f0bd70f38a49fdcb8d7ef93f7694@leisoft.cz>
Permalink:  ../8a47f0bd70f38a49fdcb8d7ef93f7694@leisoft.cz/
Also on:    postgresql.org/message-id/8a47f0bd70f38a49fdcb8d7ef93f7694@leisoft.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: lei@aswsyst.cz, badalex@gmail.com, tgl@sss.pgh.pa.us, Tim.Bunce@pobox.com, alvherre@2ndquadrant.com
  Subject: Re: BUG #13638: Exception texts from plperl has bad encoding
  In-Reply-To: <8a47f0bd70f38a49fdcb8d7ef93f7694@leisoft.cz>
  References: <20150925112345.26913.28407@wrigleys.postgresql.org> <18105.1443208708@sss.pgh.pa.us> <18478.1443209624@sss.pgh.pa.us> <20150925195120.GL295765@alvherre.pgsql> <20150927141148.GA1416@timac.local> <13303.1443397579@sss.pgh.pa.us> <CAFaPBrR-yd0fFAh+tNQ=NQ_HW=xMsbZgS8dnRjF6x6FtnSTJTQ@mail.gmail.com> <23013.1443457683@sss.pgh.pa.us> <CAFaPBrQJhiXXXioraiZL_-9funU9cbqyknAsxYZ_O5zmHCCOEg@mail.gmail.com> <8a47f0bd70f38a49fdcb8d7ef93f7694@leisoft.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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