[pacman-dev] [PATCH] xgettext : change pass-c-format flag to c-format.

Chantry Xavier shiningxc at gmail.com
Mon Feb 25 16:41:37 EST 2008


Currently xgettext apparently attempts to autodetect c format strings (eg a
string with a %s) to decide whether to use c-format flag or not.

If we use --flag=_:1:c-format instead of --flag=_:1:pass-c-format, the
c-format will be applied everywhere.
I couldn't find this documented anywhere though. But the pass prefix is
mentioned here :
http://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#xgettext-Invocation
"Specifies additional flags for strings occurring as part of the argth
argument of the function word. The possible flags are the possible format
string indicators, such as ‘c-format’, and their negations, such as
‘no-c-format’, possibly prefixed with ‘pass-’."

And c-format is documented there :
http://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html#c_002dformat-Flag
"This situation happens quite often. The printf function is often called
with strings which do not contain a format specifier. Of course one would
normally use fputs but it does happen. In this case xgettext does not
recognize this as a format string but what happens if the translation
introduces a valid format specifier? The printf function will try to access
one of the parameters but none exists because the original code does not
pass any parameters."

And that's exactly what happened with FS#9658.
So using c-format for every string will prevent this issue from happening
again.

Signed-off-by: Chantry Xavier <shiningxc at gmail.com>
---
 lib/libalpm/po/Makevars |    4 ++--
 po/Makevars             |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libalpm/po/Makevars b/lib/libalpm/po/Makevars
index 1b1b827..d751522 100644
--- a/lib/libalpm/po/Makevars
+++ b/lib/libalpm/po/Makevars
@@ -9,8 +9,8 @@ top_builddir = ../../../
 
 # These options get passed to xgettext.
 XGETTEXT_OPTIONS = \
-  --keyword=_ --flag=_:1:pass-c-format \
-  --keyword=N_ --flag=N_:1:pass-c-format
+  --keyword=_ --flag=_:1:c-format \
+  --keyword=N_ --flag=N_:1:c-format
 
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
diff --git a/po/Makevars b/po/Makevars
index 94d8294..38a4692 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -9,8 +9,8 @@ top_builddir = ../
 
 # These options get passed to xgettext.
 XGETTEXT_OPTIONS = \
-  --keyword=_ --flag=_:1:pass-c-format \
-  --keyword=N_ --flag=N_:1:pass-c-format
+  --keyword=_ --flag=_:1:c-format \
+  --keyword=N_ --flag=N_:1:c-format
 
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.
-- 
1.5.4.2





More information about the pacman-dev mailing list