Re: pltcl broken on tcl8.5 ?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltcl broken on tcl8.5 ?
Date: 2008-06-16 21:33:00
Message-ID: 4856DC0C.1030806@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> Buildfarm bobcat is broken running the pltcl regression tests - see
>> http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=bobcat&dt=2008-06-15%2022:43:01
>>
>
>
>> and I have reproduced this on Fedora 9 myself. This distro has Tcl 8.5.1.
>>
>
> Hoo, nasty. Tcl_GetVar() is resetting interp->result. Not sure why
> we didn't see this before ... maybe it didn't use to? Anyway, the
> order of execution in
>
> ereport(ERROR,
> (errmsg("%s", interp->result),
> errcontext("%s\nin PL/Tcl function \"%s\"",
> UTF_U2E(Tcl_GetVar(interp, "errorInfo",
> TCL_GLOBAL_ONLY)),
> prodesc->user_proname)));
>
> is machine-dependent, which explains why I didn't see it on HPPA.
>

According to the manual page that's only supposed to happen if the
TCL_LEAVE_ERR_MSG flag is used:

TCL_LEAVE_ERR_MSG
If an error is returned and this bit is set in flags, then an
error message will be left in the interpreter’s result, where it
can be retrieved with Tcl_GetObjResult or Tcl_GetStringResult.
If this flag bit isn’t set then no error message is left and the
interpreter’s result will not be modified.

So this looks like a bug. I guess we could work around it by saving out
interp->result first. As you say, nasty.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2008-06-16 21:46:14 Re: Crash in pgCrypto?
Previous Message Tom Lane 2008-06-16 20:44:52 Re: pltcl broken on tcl8.5 ?