Re: Add Information during standby recovery conflicts

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: masahiko(dot)sawada(at)2ndquadrant(dot)com
Cc: alvherre(at)alvh(dot)no-ip(dot)org, bdrouvot(at)amazon(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add Information during standby recovery conflicts
Date: 2020-10-15 05:52:10
Message-ID: 20201015.145210.622238854316424234.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Thu, 15 Oct 2020 14:28:57 +0900, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote in
> > ereport(..(errmsg("%s", _("hogehoge")))) results in
> > fprintf((translated("%s")), translate("hogehoge")).
> >
> > So your change (errmsg("%s", gettext_noop("hogehoge")) results in
> >
> > fprintf((translated("%s")), DONT_translate("hogehoge")).
> >
> > which leads to a translation problem.
> >
> > (errmsg(gettext_noop("hogehoge"))
>
> This seems equivalent to (errmsg("hogehoge")), right?

Yes and no. However eventually the two works the same way,
"(errmsg(gettext_noop("hogehoge"))" is a shorthand of

1: char *msg = gettext_noop("hogehoge");
...
2: .. (errmsg(msg));

That is, the line 1 only registers a message id "hogehoge" and doesn't
translate. The line 2 tries to translate the content of msg and it
finds the translation for the message id "hogehoge".

> I think I could understand translation stuff. Given we only report the
> const string returned from get_recovery_conflict_desc() without
> placeholders, the patch needs to use errmsg_internal() instead while
> not changing _() part. (errmsg(get_recovery_conflict_desc())) is not
> good (warned by -Wformat-security).

Ah, right. we get a complain if no value parameters added. We can
silence it by adding a dummy parameter to errmsg, but I'm not sure
which is preferable.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brar Piening 2020-10-15 06:27:51 Aw: Re: Minor documentation error regarding streaming replication protocol
Previous Message Thomas Munro 2020-10-15 05:42:01 Re: kevent latch paths don't handle postmaster death well