Re: Looking for someone with MinGW

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Looking for someone with MinGW
Date: 2008-12-17 03:09:01
Message-ID: 20081217112347.8A3F.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> > Thanks. The backtrace is kind of strange, but I might have found it.
> > Could you please update from CVS and re-run?
>
> same result ;-(

Hi, I found the cause.

Segfault comes from the following lines.
[ecpg/test/connect/test1.pgc]
exec sql connect to tcp:postgresql://localhost/ user connectdb;
exec sql disconnect;

-> ECPGdisconnect()
-> ecpg_finish()
-> ecpg_log("ecpg_finish: connection %s closed\n", act->name);
<HERE> -> vfprintf(debugstream, fmt, ap);

Actual error occurs in vfprintf() because act->name can be NULL.
sprintf(..., "%s", NULL) could work on some platform (the result is '(null)'),
but it crashes on Windows (msvcrt). We need to avoid passing NULLs as
arguments to "%s" format for printf families.

The attached patch fixes the segfault. Regression tests can finish
successfully but there is still a difference. The diff seems to be
trivial and come from error message changes.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
regression.diffs application/octet-stream 1.1 KB
ecpg-fix.patch application/octet-stream 577 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-17 03:15:09 Re: Looking for someone with MinGW
Previous Message Fujii Masao 2008-12-17 03:07:56 Re: Sync Rep: First Thoughts on Code