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

2005-01-17 Thread Tom Lane
Nicolai Tufar [EMAIL PROTECTED] writes:
 Sorry for such a late submission.
 I just downloaded the latest postgresql-8.0.0-rc5-3.zip installer
 for windows and it appears that Windows' printf() does not
 support placeholder replacement as described in
 http://developer.postgresql.org/docs/postgres/nls.html#AEN57284

 Original string is %s at or near \%s\ and we
 replaced it in Turkish for \%2$s\  yerinde %1$s.

Hmm.  Looking around, it seems that %n$ support is required by the
Single Unix Spec:
http://www.opengroup.org/onlinepubs/007908799/xsh/fprintf.html
but it is *not* required by C99 as far as I can tell.  I don't see any
mention of support for it in my HPUX fprintf man page, either.  So this
construct may not be as portable as we could wish.

There appear to be about 150 affected messages, in these files:

src/backend/po/pt_BR.po
src/backend/po/de.po
src/backend/po/es.po
src/backend/po/zh_CN.po
src/backend/po/tr.po
src/bin/pg_dump/po/zh_CN.po
src/bin/pg_dump/po/tr.po
src/bin/psql/po/zh_CN.po
src/bin/psql/po/zh_TW.po
src/bin/psql/po/tr.po
src/bin/scripts/po/zh_CN.po

I don't think we'll hold up release to fix this, but the affected
translators may want to think about whether they can avoid the problem
or not.

regards, tom lane

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


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

2005-01-17 Thread Tom Lane
I wrote:
 I don't think we'll hold up release to fix this, but the affected
 translators may want to think about whether they can avoid the problem
 or not.

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.

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


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

2005-01-17 Thread Magnus Hagander
 I don't think we'll hold up release to fix this, but the affected
 translators may want to think about whether they can avoid 
the problem
 or not.

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.

Might want to track down which platforms are affected by the file in
port/, and then add win32 to it, and put it up somewhere on a list of
known issues in 8.0?

//Magnus

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


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

2005-01-17 Thread Nicolai Tufar
On Mon, 17 Jan 2005 14:54:44 -0500, Tom Lane [EMAIL PROTECTED] 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

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]