Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B10CBB5DBE9 for ; Fri, 17 Jun 2011 08:10:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 41261-02 for ; Fri, 17 Jun 2011 11:10:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kepler.df7cb.de (kepler.df7cb.de [178.63.218.14]) by mail.postgresql.org (Postfix) with ESMTP id 73409B5DBC8 for ; Fri, 17 Jun 2011 08:10:35 -0300 (ADT) Received: from benz.df7cb.de (benz.df7cb.de [IPv6:2001:6f8:10ee:e:134::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "benz.df7cb.de", Issuer "df7cb.de CA" (verified OK)) by kepler.df7cb.de (Postfix) with ESMTPS id AC36A1019B1 for ; Fri, 17 Jun 2011 13:10:34 +0200 (CEST) Received: by benz.df7cb.de (Postfix, from userid 2062) id 34C066F083; Fri, 17 Jun 2011 13:10:34 +0200 (CEST) Date: Fri, 17 Jun 2011 13:10:34 +0200 From: Christoph Berg To: pgsql-bugs@postgresql.org Subject: Re: BUG #6066: [PATCH] Mark more strings as c-format Message-ID: <20110617111033.GD4130@msgid.df7cb.de> Mail-Followup-To: Christoph Berg , pgsql-bugs@postgresql.org References: <201106170818.p5H8I3ko064877@wwwmaster.postgresql.org> <4DFB137E.4040404@enterprisedb.com> <20110617091114.GC4130@msgid.df7cb.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pf9I7BMVVzbSWLtt" Content-Disposition: inline In-Reply-To: <20110617091114.GC4130@msgid.df7cb.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/143 X-Sequence-Number: 30522 --pf9I7BMVVzbSWLtt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Re: To pgsql-bugs@postgresql.org 2011-06-17 <20110617091114.GC4130@msgid.df= 7cb.de> > Unfortunately that doesn't help in this case, as the bad string isn't > tagged as "#, c-format", but still gets used as such. This seems to be > the case for many errhint() strings. Maybe xgettext should be taught > to treat all errhint() et al arguments as c-strings. Here's a patch to implement that, with backend/nls.mk updated. msgfmt -c is already available in the "maintainer-check-po" target. I'd assume this was called at least once during the release process. diff --git a/src/backend/nls.mk b/src/backend/nls.mk index 1894569..3c3f8ed 100644 *** a/src/backend/nls.mk --- b/src/backend/nls.mk *************** GETTEXT_TRIGGERS:=3D _ errmsg errmsg_plura *** 6,11 **** --- 6,15 ---- errdetail_plural:1,2 errhint errcontext \ GUC_check_errmsg GUC_check_errdetail GUC_check_errhint \ write_stderr yyerror parser_yyerror + GETTEXT_FLAGS :=3D errmsg:1:c-format errmsg_plural:1:c-format \ + errmsg_plural:2:c-format errhint:1:c-format errcontext:1:c-format \ + GUC_check_errmsg:1:c-format GUC_check_errdetail:1:c-format \ + GUC_check_errhint:1:c-format write_stderr:1:c-format =20 gettext-files: distprep find $(srcdir)/ $(srcdir)/../port/ -name '*.c' -print >$@ diff --git a/src/nls-global.mk b/src/nls-global.mk index 32b3c0f..3aa598f 100644 *** a/src/nls-global.mk --- b/src/nls-global.mk *************** *** 12,17 **** --- 12,20 ---- # GETTEXT_FILES -- list of source files that contain message strings # GETTEXT_TRIGGERS -- (optional) list of functions that contain # translatable strings + # GETTEXT_FLAGS -- (optional) list of gettext --flag arguments to mark + # function arguments that contain C format strin= gs + # (functions must be listed in TRIGGERS and FLAG= S) # # That's all, the rest is done here, if --enable-nls was specified. # *************** all-po: $(MO_FILES) *** 48,54 **** ifeq ($(word 1,$(GETTEXT_FILES)),+) po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES)) $(MAKEFILE_LIST) ifdef XGETTEXT ! $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) -f $< else @echo "You don't have 'xgettext'."; exit 1 endif --- 51,57 ---- ifeq ($(word 1,$(GETTEXT_FILES)),+) po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES)) $(MAKEFILE_LIST) ifdef XGETTEXT ! $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(addpr= efix --flag=3D, $(GETTEXT_FLAGS)) -f $< else @echo "You don't have 'xgettext'."; exit 1 endif *************** po/$(CATALOG_NAME).pot: $(GETTEXT_FILES) *** 57,63 **** # Change to srcdir explicitly, don't rely on $^. That way we get # consistent #: file references in the po files. ifdef XGETTEXT ! $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(GETTE= XT_FILES) else @echo "You don't have 'xgettext'."; exit 1 endif --- 60,66 ---- # Change to srcdir explicitly, don't rely on $^. That way we get # consistent #: file references in the po files. ifdef XGETTEXT ! $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(addpr= efix --flag=3D, $(GETTEXT_FLAGS)) $(GETTEXT_FILES) else @echo "You don't have 'xgettext'."; exit 1 endif Christoph --=20 cb@df7cb.de | http://www.df7cb.de/ --pf9I7BMVVzbSWLtt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBCAAGBQJN+zYlAAoJEExaa6sS0qeuNx8P/RdhTnhX2zheL8jI7kem7boV 1wIIk8RfyzwJ9Xe+VPQD9CP/hRKsd0D8ZhcGK68K/rPgTYzYFljdGl85LXuW35lN GYoiuD8dnXxXBauWFeJ3lOSgik8FfAIqSSkQ4TEHdQZCE4+OUzA9k/KoJe1rIA4e hu+aq2874JHakeOJYr3r4qWU0C75rGicc/nSzYthddWRGTfycrDA2iltTNBPt3lR ZDUn8uEwc+13PHPcIpSLUbHU2UHb1Jj2Tezv0lQIaA79veB8XHZL7yeFswDLK10T ogK+PZ8npB9RjOc58b7S1mdTG0Y9hn8odLWPQdKCUs6W4YyozJilB6l65scVA9nu AaAKdEuhbp4kXgcblOXKPLF0DKK0aupWgMmRr9RIBySy7RPV0DmUySul3REGj+my RoUnkgihj4JBopsNEBKCpTzvQXu2ilTqEib+eFUbP+B20M/tm/cU3N1TdFGRTPRk pdECGqAP0JIDMcVrwrwSKc+Hj/mkz2ngz287Ya+GR7v+CaeVJPqePkwJuTXWJrqq IdS5m/LOaicawP1AOtY4dWowPSVB43ycSFVzEazuwDjUzgnrZ7qJ1DN/Ikm+pP77 4VBgThshsuPXBflpcMXLU07nchbQ93BQts5+MH82559zCihXS4SyYbjqcQtRny6x HTM6hKRhz0SMkHK48BtQ =VZSs -----END PGP SIGNATURE----- --pf9I7BMVVzbSWLtt--