Re: [PATCHES] snprintf() argument reordering not working

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nicolai Tufar <ntufar(at)gmail(dot)com>, devrim(at)kivi(dot)com(dot)tr, Magnus Hagander <mha(at)sollentuna(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] snprintf() argument reordering not working
Date: 2005-12-05 05:21:41
Message-ID: 200512050521.jB55LfE07355@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


OK, a few things. First, Tom has fixed snprintf.c so it should properly
process positional parameters now. Would you first test the libintl
version of *printf to see if it can process %$ parameters (probably by
hacking up any language file and testing the printing), and then try
your patch below to see if it is properly reorders the arguments. If
libintl does not reorder properly, but our snprintf.c does, would you
please generate an appliable patch we can put into 8.1.X? Thanks.

I know I am asking a lot, but you are "the man" on this one. :-)

---------------------------------------------------------------------------

Andrew Dunstan wrote:
>
>
> Bruce Momjian wrote:
>
> >Tom Lane wrote:
> >
> >
> >>Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> >>
> >>
> >>>That got me through the backend compile and through libpq to ecpg, which
> >>>fell over at the link stage complaining about missing references to
> >>>pg_sprintf and pg_snprintf ... not sure how to fix that - windows
> >>>experts, please advise.
> >>>
> >>>
> >>Plan A would be to make libpq export pg_snprintf and friends, Plan B
> >>would be to give ecpg its own copy of snprintf.o. Plan A is probably
> >>better since you're going to hit the same issue no doubt in all of the
> >>src/bin programs.
> >>
> >>
> >
> >I am confused why we would need either of these. All apps use
> >libpgport, and that pg_*printf should be in that library. The original
> >work Andrew did has problems particularly with ecpg, but why does ecpg
> >cause problems? Doesn't it link in pgport?
> >
> >
> >
>
>
>
> libpgtypes doesn't link with either libpgport or libpq.
>
> What I have done to get a working build in addition to the previous
> report is to undef snprintf and sprintf in
> interfaces/pgtypeslib/extern.h (instead of creating an additional link
> burden), and to add entries for pg_snprintf, pg_sprintf and pg_fprintf
> to interfaces/libpq/exports.txt. That let me get a clean compile and
> regression run. The diff against 8.1 is attached for comment.
>
> I suspect we should probably add all the pg_*printf functions to
> exports.txt.
>
> (Of course, first you need to install gettext and libintl from the
> gnuwin32 project, or you can't even configure with --enable-nls)
>
> cheers
>
> andrew
>
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-05 05:25:33 Re: port/snprintf.c (was Re: Numeric 508 datatype)
Previous Message Bruce Momjian 2005-12-05 05:10:35 Re: port/snprintf.c (was Re: Numeric 508 datatype)

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-12-05 05:25:33 Re: port/snprintf.c (was Re: Numeric 508 datatype)
Previous Message Bruce Momjian 2005-12-05 05:10:35 Re: port/snprintf.c (was Re: Numeric 508 datatype)