bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

avoid some core dumps when translations are bad


From: Paul Eggert
Subject: avoid some core dumps when translations are bad
Date: Fri, 11 Aug 2006 13:57:50 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Now that we're assuming gettext 0.15, I installed this: among other
things it prevents some core dumps when there are bad translations.

By "bad" I don't mean the French is bad.  I mean that the translated
format has different C format specifiers than the original, which can
lead to undefined behavior.

2006-08-11  Paul Eggert  <address@hidden>

        * bootstrap: Put in need-ngettext argument to AM_GNU_GETTEXT,
        to prevent failures when building on older platforms.
        Check for autopoint failure.
        Set XGETTEXT_OPTIONS to values that check for C format strings,
        so that translators are warned about them (this also helps
        prevent core dumps).

Index: bootstrap
===================================================================
RCS file: /cvsroot/bison/bison/bootstrap,v
retrieving revision 1.40
retrieving revision 1.41
diff -p -u -r1.40 -r1.41
--- bootstrap   2 Aug 2006 05:13:20 -0000       1.40
+++ bootstrap   11 Aug 2006 20:52:55 -0000      1.41
@@ -222,7 +222,8 @@ esac
 
 (echo '# This file is generated automatically by "bootstrap".' &&
  echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' &&
- $gnulib_tool --extract-autoconf-snippet $gnulib_modules &&
+ $gnulib_tool --extract-autoconf-snippet $gnulib_modules |
+   sed 's/AM_GNU_GETTEXT(\[external]/&, [need-ngettext]/' &&
  echo '])'
 ) >m4/gnulib.m4 || exit
 
@@ -235,7 +236,7 @@ esac
 # Reconfigure, getting other files.
 
 echo "$0: autopoint --force ..."
-autopoint --force
+autopoint --force || exit
 
 # We don't need intl, so remove it.
 intl_files_to_remove='
@@ -286,8 +287,20 @@ done
 
 
 # Put bug-reporting address into po/Makevars.
-echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= address@hidden/' 
po/Makevars.template >po/Makevars ..."
-sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= address@hidden/' po/Makevars.template 
>po/Makevars
+echo "$0: Creating po/Makevars from po/Makevars.template ..."
+sed '
+  /^MSGID_BUGS_ADDRESS *=/s/=.*/= address@hidden/
+  /^XGETTEXT_OPTIONS *=/{
+    s/$/ \\/
+    a\
+       --flag=_:1:pass-c-format \\\
+       --flag=N_:1:pass-c-format \\\
+       --flag=error:3:c-format --flag=error_at_line:5:c-format \\\
+       --flag=warn:1:c-format --flag=warn_at:2:c-format \\\
+       --flag=complain:1:c-format --flag=complain_at:2:c-format \\\
+       --flag=fatal:1:c-format --flag=fatal_at:2:c-format
+  }
+' po/Makevars.template >po/Makevars
 
 # Likewise for runtime-po/Makevars, except also change a few other parameters.
 sed '




reply via email to

[Prev in Thread] Current Thread [Next in Thread]