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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: 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-04 16:09:48
Message-ID: 439314CC.6090400@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:

>OK, here is what happened. In March 2005, we got reports of compile
>problems on Win32 using NLS:
>
> http://archives.postgresql.org/pgsql-hackers/2005-03/msg00710.php
>
>(See the quoted text under the posted text as well.) Basically,
>libintl.h on Win32 replaces *printf calls with its own versions, and
>does it using macros, _just_ like we do. This of course causes
>conflicts and the system fails to compile. The _fix_ was to disable
>port/*printf on Win32 when using NLS because NLS wants to use its own
>*printf. I _assumed_ that libintl.h did this so it could use its own
>routines that understood %$, but never verified that. It didn't seem we
>had any choice to fix this, and got no problem reports about %$ not
>working until yours.
>
>After over a month with no solution I added the code as you see it now:
>
> http://archives.postgresql.org/pgsql-hackers-win32/2005-05/msg00011.php
>
>Oh, and it was Andrew Dunstan who worked on this, not Magnus. (Sorry
>Magnus, Hello Andrew.)
>
>Anyway, I think the big question is, was the pginstaller built with a
>libintl that replaces *printf, and is it an *printf that doesn't
>understand positional parameters, and so, how can we fix it.
>
>
>

Well , I diagnosed the problem - you're on your own as far as the
"solution" goes ;-)

On thing that seems clear to me is that we need a way of testing NLS
support.

Tom said:

>Would it work to modify c.h so that it #include's libintl.h, then #undefs
>these macros, then #includes port.h to define 'em the way we want?
>Some or all of this might need to be #ifdef WIN32, but that seems like
>a reasonably noninvasive solution if it can work.
>

IIRC last time I tried this it didn't work too well ;-( I will have
another go. I think it's the best way to go.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Lindner 2005-12-04 16:25:20 Re: Upcoming PG re-releases
Previous Message Paul Lindner 2005-12-04 15:57:15 MIN() performance regression 8.0 -> 8.1

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2005-12-04 18:53:06 Re: [PATCHES] snprintf() argument reordering not working
Previous Message Bruce Momjian 2005-12-04 04:10:18 Re: return can contains any row or record functions