Daiki Ueno [Wed, 28 Jan 2015 07:50:20 +0000 (16:50 +0900)]
msgfilter: Add --newline option
The filter program was supposed to handle translation without a
newline character at the end of line. This was causing
portability problems with standard text processing programs on
some platforms (BSD sed, for instance) and not friendly towards
POSIX, where a "text file" is required to have an ending newline.
The new --newline option controls the behavior. If it is given,
both filter input and output are assumed to end with a newline
character.
* gettext-tools/src/msgfilter.c (newline): New variable.
(long_options): Add --newline option.
(main): Handle --newline option.
(usage): Document --newline option.
(process_string_with_newline): New function which wraps
process_string.
(process_message): Use process_string_with_newline instead of
process_string if --newline is specified.
* gettext-tools/tests/msgfilter-8: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add new test.
* xgettext.c (remember_a_message): Building with gcc's
-fsanitize=undefined and running tests triggered:
xgettext.c:2425:17: runtime error: null pointer passed as argument \
2, which is declared to never be null
Adjust the argument of strncmp to never be null.
* msgmerge.c (message_merge): Likewise for memcpy.
Daiki Ueno [Fri, 23 Jan 2015 03:11:41 +0000 (12:11 +0900)]
build: Update libtool files to 2.4.5
* m4/libtool.m4: Update from libtool-2.4.5, with modifications.
2008-04-06 Bruno Haible <bruno@clisp.org>
* m4/libtool.m4 (LT_INIT): When setting LIBTOOL, use
CONFIG_SHELL; don't assume that the Makefile.in will set SHELL
to ${CONFIG_SHELL}.
* m4/ltoptions.m4: Likewise.
* m4/ltversion.m4: Likewise.
* build-aux/ltmain.sh: Likewise.
Daiki Ueno [Fri, 23 Jan 2015 02:22:47 +0000 (11:22 +0900)]
build: Fix parallel build from git checkout
Since po-gram-gen2.h depends on po-gram-gen.h, an explicit
dependency on the YACC rule is needed for parallel compilation.
* Makefile.am (po-gram-gen.h): Depend on po-gram-gen.c.
Will Newton [Wed, 21 Jan 2015 02:55:02 +0000 (11:55 +0900)]
intl: Merge from glibc
* bindtextdom.c: Update copyright to use year ranges.
* dcgettext.c: Update copyright to use year ranges.
[_LIBC]: Use libc_hidden_def instead of INTDEF.
* dcigettext.c: Update copyright to use year ranges.
Test HAVE_TSEARCH with #ifdef rather than #if.
(DCIGETTEXT) [_LIBC]: Use __current_locale_name instead of
_current_locale_name.
* dcngettext.c: Update copyright to use year ranges.
* dgettext.c: Update copyright to use year ranges.
[_LIBC]: Remove use of INTUSE macro.
* dngettext.c: Update copyright to use year ranges.
* explodename.c: Likewise.
* finddomain.c: Update copyright to use year ranges.
(_nl_finddomain_subfreeres): Use void in no-arguments function
definition.
* gettext.c: Update copyright to use year ranges.
[_LIBC]: Remove use of INTUSE macro.
* gettextP.h: Update copyright to use year ranges.
[_LIBC]: Forward declaration of struct loaded_domain.
* gmo.h: Update copyright to use year ranges.
* hash-string.c: Likewise.
* hash-string.h: Likewise.
* l10nflist.c: Update copyright to use year ranges.
[_LIBC]: Remove use of INTUSE macro.
Wrap pop function in [!ARCH_POP].
* loadinfo.h: Update copyright to use year ranges.
* loadmsgcat.c: Likewise.
* localealias.c: Update copyright to use year ranges.
Test ENABLE_RELOCATABLE with #ifdef rather than #if.
[_LIBC]: Use __strcasecmp_l for strcasecmp.
[_LIBC]: Use __fgets_unlocked for FGETS.
Test HAVE_DECL_FGETS_UNLOCKED with #ifdef rather than #if.
Test HAVE_DECL_FEOF_UNLOCKED with #ifdef rather than #if.
(read_alias_file) [_LIBC]: Open file with O_CLOEXEC.
(extend_alias_table): Use void in no-arguments function
definition.
* ngettext.c: Update copyright to use year ranges.
* plural-exp.c: Update copyright to use year ranges.
Test __APPLE_CC__ with #ifdef rather than #if.
(GERMANIC_PLURAL): Make const.
(init_germanic_plural): Use void in no-arguments function
definition.
* plural-exp.h: Update copyright to use year ranges.
(GERMANIC_PLURAL): Make const.
* plural.y: Update copyright to use year ranges.
* textdomain.c: Likewise.
* gettext-tools/src/x-c.c (phase5_get): Reset raw_expected at the
beginning of the function.
* gettext-tools/tests/xgettext-c-20: Improve test coverage of raw string
tests.
Daiki Ueno [Tue, 13 Jan 2015 03:09:08 +0000 (12:09 +0900)]
c++: Make C++11 raw string recognition stricter
Reported by Vaclav Slavik at:
<http://savannah.gnu.org/bugs/?43970>.
* gettext-tools/src/x-c.c (struct token_ty): New field 'escape'.
(struct xgettext_token_ty): New field 'escape'.
(phase5_get): Recognize raw strings more strictly. Set 'escape'
field of token appropriately for string literals.
(extract_parenthesized): Respect 'escape' field of token.
* gettext-tools/tests/xgettext-c-20: Adjust to the latest xgettext C++
scanner change; don't accept unbalanced prefix in raw string literal.
Daiki Ueno [Tue, 13 Jan 2015 03:00:35 +0000 (12:00 +0900)]
c++: Differentiate scanning logic from C
To enable raw string literals only in C++, add a flag indicating
the current source language is C++.
Suggested by Vaclav Slavik at:
<https://savannah.gnu.org/bugs/?43970>.
* gettext-tools/src/x-c.h (extract_cxx): New declaration.
(SCANNERS_C): Use extract_cxx for "C++".
* gettext-tools/src/x-c.c (cxx_extensions): New variable.
(phase5_get): Respect cxx_extensions and recognize raw string
literals only when it is set.
(extract_cxx): New function.
(extract_c, extract_objc): Reset cxx_extensions.
* gettext-tools/tests/xgettext-c-20: Adjust the source file name
from *.c to *.cc to enable handling of raw string literals.
Daiki Ueno [Thu, 8 Jan 2015 02:09:14 +0000 (11:09 +0900)]
examples: Make hello-c-gnome3 translator friendly
Suggested by Benno Schulenberg in:
<https://lists.gnu.org/archive/html/bug-gettext/2015-01/msg00003.html>.
* hello-c-gnome3/hello.gschema.xml: Use "use-markup" property
instead of "sensitive", to clarify the meaning of the extracted
strings.
* hello-c-gnome3/hello.c (HelloApplicationWindow): Rename the
"label2" member to "label".
(update_content): New function.
(clicked_callback): Rename from quit_callback and call
update_content instead of quitting. All callers changed.
* hello-c-gnome3/hello.ui: Abolish the first label and put a
translatable text inside the button.
Václav Slavík [Sat, 3 Jan 2015 23:39:29 +0000 (08:39 +0900)]
intl: Add missing libintl.h dependency from pluralx.$lo
plural(x).c depends on libintl.h if ENABLE_NLS, but the makefile
didn't have corresponding dependency for pluralx.c, because d2d04ba forgot to add it. Fix by using $(PLURAL_OBJECT) for the
dependency rule too.
* Makefile.in ($(PLURAL_OBJECT)): Depend on libintl.h.
Daiki Ueno [Thu, 25 Dec 2014 04:04:47 +0000 (13:04 +0900)]
build-aux: Update texinfo.tex to 2014-12-03.16
* build-aux/texinfo.tex: Update to 2014-12-03.16. Needed because
the original texinfo does not allow @heading usage inside
@enumeration and texi2dvi fails due to this.
Daiki Ueno [Fri, 12 Dec 2014 08:18:51 +0000 (17:18 +0900)]
lisp, scheme: Avoid invalid memory access
* format-lisp.c (make_intersected_list): Don't dereference
potentially released memory. 'append_repeated_to_initial' may
release the LIST->element. Spotted by clang-analyzer.
* format-scheme.c (make_intersected_list): Likewise.
Daiki Ueno [Fri, 5 Dec 2014 06:18:55 +0000 (15:18 +0900)]
msgunfmt: Avoid integer overflow using xsize
* read-mo.c (get_uint32, get_sysdep_string): Use xsum to avoid
integer overflow, when checking length and offset fields.
Reported by Jakub Wilk at:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772088>.
Daiki Ueno [Fri, 5 Dec 2014 04:49:31 +0000 (13:49 +0900)]
examples: Include hello-*.pot in the distribution
Partially revert 2c3d71ce, as it broke "make dist". Instead,
include all the generated POT files in the distribution to prevent
re-generation of those files.
* Makefile.am (distdir1): Call update-po in po/Makefile.
* po/Makefile.am ($(DOMAIN).pot-update): Specify --directory for
xgettext invocation.
(DISTCLEANFILES): Move $(SMALLPOTS)...
(MAINTAINERCLEANFILES): ...here.
(distdir1): Include $(SMALLPOTS) in the distribution.
Daiki Ueno [Thu, 4 Dec 2014 03:21:35 +0000 (12:21 +0900)]
examples: Don't forcibly regenerate POT files on 'make dist'
Previously we generated POT files on 'make dist'. However, it
take some time to complete and require autotools bootstrap for
each project.
* Makefile.am (distdir1): Don't invoke update-po rule in po/Makefile.
* po/Makefile.am (distdir1): Don't invoke update-po rule.
Daiki Ueno [Thu, 4 Dec 2014 02:59:53 +0000 (11:59 +0900)]
intl: Make the LCOV workaround non-intrusive
* gettext-runtime/intl/Makefile.in (PLURAL_OBJECT): New variable.
(OBJECTS): Refer to $(PLURAL_OBJECT) instead of plural.$lo.
(pluralx.c, pluralx.lo): New rule.
(mostlyclean): Remove pluralx.c.
* gettext-tools/configure.ac: Replace PLURAL_OBJECT in intl/Makefile.
Daiki Ueno [Wed, 3 Dec 2014 06:14:44 +0000 (15:14 +0900)]
intl: Work around LCOV relative base directory resolution
* gettext-runtime/intl/Makefile.in (plural.lo): Resolve relative
source file name given with '#line' directive, when $(srcdir) !=
$(builddir).
(mostlyclean): Remove plural.c generated in the 'plural.lo' rule.
* gettext-tools/src/plural-exp.c: Include "../intl/plural.c" instead
of "../../gettext-runtime/intl/plural.c".
Daiki Ueno [Mon, 1 Dec 2014 07:45:57 +0000 (16:45 +0900)]
doc: Document placement of extracted comment blocks
* xgettext.texi: Mention that extracted comment blocks must be
adjacent to keyword lines.
Reported by Yves-Gwenael Bourhis at:
<https://savannah.gnu.org/bugs/index.php?42376>.
Daiki Ueno [Mon, 1 Dec 2014 04:39:30 +0000 (13:39 +0900)]
c#: Recognize Unicode surrogate character pair
* x-csharp.c (accumulate_escaped): Change the first argument type
from 'struct string_buffer *' to 'struct mixed_string_buffer *',
for Unicode surrogate character pair handling; all callers
changed. Reported by Petr Kadlec at:
<https://savannah.gnu.org/bugs/?32505>.
Daiki Ueno [Mon, 1 Dec 2014 03:18:04 +0000 (12:18 +0900)]
build: Update libtool files to 2.4.4
* m4/libtool.m4: Update from libtool-2.4.4, with modifications.
2008-04-06 Bruno Haible <bruno@clisp.org>
* m4/libtool.m4 (LT_INIT): When setting LIBTOOL, use
CONFIG_SHELL; don't assume that the Makefile.in will set SHELL
to ${CONFIG_SHELL}.
* m4/ltoptions.m4: Likewise.
* m4/ltversion.m4: Likewise.
* build-aux/ltmain.sh: Likewise.
Daiki Ueno [Fri, 28 Nov 2014 04:21:37 +0000 (13:21 +0900)]
msgfilter: Fix read buffer allocation for empty input
* msgfilter.c (prepare_read): Increase allocated buffer size even
if the original size is < 2.
Reported by Robin McCorkell at:
<https://savannah.gnu.org/bugs/?43720>.
Daiki Ueno [Fri, 28 Nov 2014 03:17:06 +0000 (12:17 +0900)]
build: Update libtool files to 2.4.3
* m4/libtool.m4: Update from libtool-2.4.3, with modifications.
2008-04-06 Bruno Haible <bruno@clisp.org>
* m4/libtool.m4 (LT_INIT): When setting LIBTOOL, use
CONFIG_SHELL; don't assume that the Makefile.in will set SHELL
to ${CONFIG_SHELL}.
* m4/ltoptions.m4: Likewise.
* m4/ltsuger.m4: Likewise.
* m4/ltversion.m4: Likewise.
* m4/lt~obsolete.m4: Likewise.
* build-aux/ltmain.sh: Likewise.
Daiki Ueno [Thu, 27 Nov 2014 09:32:23 +0000 (18:32 +0900)]
javascript: Simplify Unicode character escape handling
ECMA-262 only supports "\uXXXX" style Unicode character escape and
we don't need extra space for character names.
* x-javascript.c: Don't include "uniname.h".
(phase2_pushback): Decrease to 5. Don't refer to UNINAME_MAX.
Daiki Ueno [Tue, 18 Nov 2014 03:11:22 +0000 (12:11 +0900)]
read-mo: Check size_t overflow
* read-mo.c: Include "xsize.h".
(get_string): Use xsum3 to avoid overflow, when checking length
and offset fields.
Reported by Jakub Wilk at:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769901>.
Daiki Ueno [Tue, 28 Oct 2014 07:38:40 +0000 (16:38 +0900)]
xgettext: Allow plural extraction from a single argument function
The commit 8137d2b4 was a wrong fix since both singular/plural
msgids may point to the same address for Qt4 plural forms. This
reverts the commit and fix the original double-free problem in the
right way. Thanks to Jesper Fehrlund for suggestions.
* gettext-tools/src/xgettext.c (arglist_parser_remember_literal):
Don't ignore plural argument even if ARGNUM1 equals to ARGNUM2.
(arglist_parser_done): Make a copy of best_cp->msgid_plural when
passing it to remember_a_message_plural, if it equals to
best_cp->msgid. Also move code conversion logic earlier taking into
account of the ownership transfer of best_cp->msgid.
* gettext-tools/src/xgettext-12: Test a single argument function.
Daiki Ueno [Tue, 28 Oct 2014 06:51:01 +0000 (15:51 +0900)]
xgettext: Fix double-free in singular/plural argument extraction
After commit 6aa7b7ed in 2009, xgettext assumed that ARGNUM1 and
ARGNUM2 of -k are different. That could cause an double-free in
exceptional cases.
Reported by Johan Liljegren in:
<https://lists.gnu.org/archive/html/bug-gettext/2014-10/msg00028.html>.
* xgettext.c (arglist_parser_remember_literal): Don't assume that
ARGNUM1 and ARGNUM2 are different.
Daiki Ueno [Wed, 15 Oct 2014 03:37:45 +0000 (12:37 +0900)]
tests: Support newer ncurses with italic caps in xterm terminfo
* tests/test-term-ostream-xterm-basic-italic.out: New file.
* tests/test-term-ostream-xterm: Use it as possible test result.
* Makefile.am (EXTRA_DIST): Add new files.
Needed for ncurses >= 5.9-20140906 that defines sitm/ritm in the
xterm-basic terminfo definition.