[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [patch] l10n crashes

From: Max Bowsher <maxb_at_ukf.net>
Date: 2005-09-03 23:33:27 CEST

Julian Foad wrote:
> Max Bowsher wrote:
>> Branko ─îibej wrote:
>>>
>>> I thought the gettext tools could verify that the format strings in the
>>> translated messages are correct? If they can, we should do this checking
>>> in a post-commit hook.
>>
>> The problem is that they only check strings which xgettext has
>> heuristically determined to be format strings.
>>
>> One major category which is not getting checked properly is:
>>
>> some_printf_like_function (_("Just a plain string with no format
>> characters));
>>
>> Now, if a translation accidentally adds a % code, .... CRASH.
>>
>>
>> Not sure how best we can solve this.
>
> Well, GNU xgettext (v0.14.1) has a "--flag" option for this. Here are
> such
> options covering all of the functions on which we have put "__attribute__
> ((format(...)))":
...
> Can you add those options into the build system so that they can be used
> easily? I don't know where they would go.

Excellent, I missed that option.

Here is a patch which makes use of it.
This increases the requirements to run "make locale-gnu-{po-update,pot}" to
gettext 0.13 or later.
I think this is acceptable, given the small set of people who need to use
those commands, and the importance of avoiding crashes.

Max.

Index: Makefile.in
===================================================================
--- Makefile.in (revision 16034)
+++ Makefile.in (working copy)
@@ -273,6 +273,19 @@
          -name "*.c" -print -or \
          -name "svn_error_codes.h" -print | \
         $(XGETTEXT) --sort-by-file -k_ -kN_ -kSVN_ERRDEF:3 \
+ --flag=_:1:pass-c-format \
+ --flag=svn_cmdline_printf:2:c-format \
+ --flag=svn_cmdline_fprintf:3:c-format \
+ --flag=svn_error_createf:3:c-format \
+ --flag=svn_error_wrap_apr:2:c-format \
+ --flag=svn_stream_printf:3:c-format \
+ --flag=svn_stream_printf_from_utf8:4:c-format \
+ --flag=svn_string_createf:2:c-format \
+ --flag=svn_string_createv:2:c-format \
+ --flag=svn_stringbuf_createf:2:c-format \
+ --flag=svn_stringbuf_createv:2:c-format \
+ --flag=dav_svn__send_xml:3:c-format \
+ --flag=svn_fs_bdb__dberrf:3:c-format \
          --msgid-bugs-address=dev@subversion.tigris.org \
          --add-comments --files-from=- -o po/subversion.pot )

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Sep 3 23:34:12 2005

This is an archived mail posted to the Subversion Dev mailing list.