Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32

From: Nicolai Tufar <ntufar(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32
Date: 2005-01-17 20:16:31
Message-ID: d809293905011712162e0d34fc@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-hackers-win32
On Mon, 17 Jan 2005 14:54:44 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Also, it looks like src/port/snprintf.c is not %n$ capable either.
> I'm not sure which platforms that affects.
> 
> A possible route to a solution is to upgrade snprintf.c and then use
> it on platforms that don't have this support.  This only fixes those
> cases where we go through snprintf, which is probably not all of the
> affected messages, but it might be enough.  It's not happening for
> 8.0.0 though.

Bad news for the Turks. Turkish language syntax
is lake Latin: the verb is always at the end. Because
of that almost all messages that have two or more 
placeholders are broken under Windows.

The solution you propose seem to be a trivial exercise:
1. write a replacement function, say, pg_snprintf() that 
    would shuffle input arguments, replace %x$ with % 
    and then call libc's snprintf();
2. replace snprintf() in all source files with pg_snprintf();
3. Update Makefiles to use our custom function on broken
    platforms or default to snprinf(). (Or maybe pg_snprintf()
    should be a #define);
4. Tell everyone to use pg_snprintf() instead of snprintf()
     from now on.

I would like volunteer to implement this for 8.1 and
would be honoured if I get a chance to contribute.

>                         regards, tom lane

Best regards,
Nicolai Tufar

In response to

pgsql-hackers by date

Next:From: Andrew SullivanDate: 2005-01-17 20:16:49
Subject: Re: ARC patent
Previous:From: Devrim GUNDUZDate: 2005-01-17 20:16:07
Subject: Re: [pgsql-hackers-win32] %2$, %1$ gettext placeholder

pgsql-hackers-win32 by date

Next:From: Magnus HaganderDate: 2005-01-17 20:18:34
Subject: Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32
Previous:From: Devrim GUNDUZDate: 2005-01-17 20:16:07
Subject: Re: [pgsql-hackers-win32] %2$, %1$ gettext placeholder

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group